TOOLS
MongoDB Shell (mongosh)
An interactive tool for data manipulation (CRUD), advanced querying (pipelines), and management of users, data replication, and scaling.
Perform CRUD operations
Run aggregation pipelines
Learning hub
FAQ
MongoDB Shell (mongosh) is an interactive tool used for direct data manipulation, advanced querying, database administration, and access control. It can perform all essential data operations: creating/viewing, adding, updating, and deleting data. You can also run powerful queries to analyze your data and perform administrative tasks like managing user access or creating indexes to improve performance. All of these actions can be written into scripts, allowing you to easily automate repetitive tasks.
The primary difference has to do with data vs. data infrastructure.
The simplest way to understand the difference is to think about what you want to manage.
- The MongoDB Shell (mongosh) allows you to interact with and manage data in your MongoDB database. It can be utilized with any type of MongoDB deployment, including Atlas, Enterprise Advanced, or MongoDB Community.
- The Atlas CLI lets you manage cloud infrastructure for your database, including servers and security settings. It is specifically designed to work with Atlas clusters only.
You should use the MongoDB Shell (mongosh) when you need to:
- Interact with your data, such as viewing, adding, updating, or deleting documents.
- Perform complex queries and aggregations to analyze data. You can also write and execute custom Node.js scripts.
- Perform database-specific administrative tasks, like creating indexes to improve performance or managing user roles within a database.
You should use the Atlas CLI when you need to:
- Automate and manage your Atlas cloud environment, such as creating, updating, or deleting entire database clusters.
- Configure the infrastructure and security of your Atlas project, like setting up network access rules or managing backups.
- Integrate MongoDB Atlas into your DevOps workflows and CI/CD pipelines for automated deployments and management.
Interact with your database programmatically
- Perform CRUD operations
- Execute Aggregation Pipelines
- Manage Databases and Collections
- Administer Servers
- Manage access and security