MongoDB Shell Basics

use [database name]  

Creates or switches to use a database, db becomes the variable to reference the current database

show dbs  

List all databases

db.[collection_name].save({ a: ‘hey’})  

Saves a document to the collection, if the collection does not exist on the current database mongo will create it

show collections  

List all collections in current database

db.[collection_name].find()  

List all documents for collection

db.[collection_name].find({ a: ‘hey’})  

Find all documents where the key a is equal to hey