MongoDB Shell (
On this page
The MongoDB Shell,
Node.js 16.x REPL environment for interacting with MongoDB
deployments. You can use the MongoDB Shell to test queries and operations
directly with your database.
mongosh is available as a standalone package in the
MongoDB Download Center.
Download and Install
To learn how to download and install the
mongosh binary, see
Connect to a MongoDB Deployment
Once you have installed the MongoDB Shell and added it to your system
PATH, you can connect to a MongoDB deployment. To learn more, see
Connect to a Deployment.
The MongoDB Shell versus the Legacy
mongo shell was deprecated in MongoDB 5.0 and removed in
MongoDB 6.0. The new MongoDB Shell,
mongosh, offers numerous
advantages over the legacy shell. The new shell has improved:
compatibility with the MongoDB Node.js driver
Some legacy methods are unavailable or have been replaced with updated
mongosh. To maintain backwards compatibility, the legacy
mongosh supports use the same syntax as the
corresponding methods in the
To see the complete list of methods supported by
mongosh, refer to:
MongoDB Shell Methods.