use [db-name] switch to a particular database e.g., use xmeng show collections show the collections in the database e.g., show collections mybooks xmeng test post Address db.[coll-name].find() list all documents in the collection e.g., db.post.find() db.[coll-name].find({conditions}) find and list documents with given conditions e.g., db.post.find({"likes":{$gt:45}}) db.post.find({"title":"fifth world"}) note: texts are case-sensitive when making comparisions, "text" != "Text" db.[coll-name].drop() delete the collection named 'coll-name' e.g., db.Address.drop() db.[coll-name].find().limit(NUMBER) return only NUMBER of documents from the query e.g., db.Address.find({"borough":"Manhattan"}).limit(3) will return only the first three documents that meet the condition db.[coll-name].find().limit(NUMBER1).skip(NUMBER2) skip the first NUMBER2 documents among the ones that meet the condition, then limit the documents to be returned to NUMBER1 e.g., assume exeucting the find() command returns 10 documents, the following command will skip the first two, then return the next three (i.e., documents 3, 4, and 5) db.Address.find({"borough":"Manhattan"}).limit(3).skip(2) db.[coll-name].insertOne() insert one record into the named collection e.g., db.Address.insertOne({"address": {"building": "921", "coord": [-73.9691347, 40.6389857], "street": "Cortelyou Rd", "zipcode": "11218"}, "borough": "Brooklyn", "cuisine": "Other", "grades": [], "name": "Cold Press'D", "restaurant_id": "50018995"}) quit() # leaves the MongoDB mongo --host eg-mongodb.bucknell.edu -u owner -p --authenticationDatabase dbname dbname # command line login