Skip to content

MongoDB Cheatsheet

mongo shell

Helpers

# List available databases
> show dbs

# Displays the database you are using
> db

# Switch database. This creates a new DB if it does not exist
> use <database>

# Show collections
> show collections

# Displays all the commands available
> help

# Run JavaScript File
> load("myScript.js")

# Exit the shell
> quit()

References


Last update: May 5, 2023