Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Mongo Shell Commonly Used Commands and Methods Quick Reference

Mongo Shell Commonly Used Commands and Methods Quick Reference

Intermediate 3 min read 07 Jun 2025 19K views
Mongo Shell Commonly Used Commands and Methods Quick Reference

MongoDB shell is an interactive JavaScript shell which help you to manage a MongoDB server. It provides a set of commands to create, update, delete and query your MongoDB database. Here is a list of commonly used commands and methods.

If you're just starting out, you might want to check out a MongoDB Certification Free resource to strengthen your basics alongside using these shell commands.

Command Helpers

Methods and Commands
Description
help
Show list of commonly used methods and commands with description
db.help()
Show a list of database methods with description
db.<collection>.help()
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
use <db_name>
Switch from current database to <db_name>
show collections
Show a list of all collections for current database
show users
Show a list of all users for current database
show roles
Show a list of all user-defined and built-in roles for current database

Basic Shell JavaScript Operations

Operations
Description
db.<collection_name>.find()
Find all documents in the collection
db.<collection_name>.insert()
Insert a new document into the collection
db.<collection_name>.update()
Update an existing document in the collection.
db.<collection_name>.save()
Insert either a new document or update an existing document in the collection
db.<collection_name>.remove()
Delete all documents from the collection
db.<collection_name>.drop()
Completely Drops or removes the collection
db.<collection_name>.createIndex()
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.

Also, consider exploring a MongoDB Free Course to dive deeper and practice with real-world examples.

Read More: Top 50 MongoDB Interview Questions and Answers
Test yourself in 5 minutes

Take the free Mongodb skill challenge to see your strengths and the gaps to fix next.

Start the challenge
Share LinkedIn X Facebook WhatsApp

About the author

Shailendra Chauhan

Shailendra Chauhan

Microsoft MVP, Founder & CEO at ScholarHat

He is a renowned Speaker, Solution Architect, Mentor, and 11-time Microsoft MVP (2016–2026). With expertise in AI/ML, GenAI, System Design, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development, he bridges traditional frameworks with next-gen innovations.

He has trained 1 Lakh+ professionals across the globe, authored 45+ bestselling eBooks and 1000+ technical articles, and mentored 20+ free courses. As a corporate trainer for leading MNCs like IBM, Cognizant, and Dell, Shailendra continues to deliver world-class learning experiences through technology & AI.

Keep learning

Courses that go with this tutorial