Mongo Shell Commonly Used Commands and Methods Quick Reference
Methods and Commands
Show list of commonly used methods and commands with description
Show a list of database methods with description
Show help on collection methods. The <collection_name> can be the name of an existing collection or a non-existing collection.
show dbs / show databases
Show a list of all mongodb databases on the server
Switch from current database to <db_name>
Show a list of all collections for current database
Show a list of all users for current database
Show a list of all user-defined and built-in roles for current database
Find all documents in the collection
Insert a new document into the collection
Update an existing document in the collection.
Insert either a new document or update an existing document in the collection
Delete all documents from the collection
Completely Drops or removes the collection
Create a new index on the collection if the index does not exist otherwise, the operation has no effect
What do you think?
That’s it for now! I hope you get a good idea of Mongo shell commands. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.