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.
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.
mongosh console is line oriented. However, you can
also use an editor to work with multiline functions. There are two
- An external editor, accessed with the
- A built-in editor, accessed with the
For further details see Editor Mode.
The new MongoDB Shell,
mongosh, offers numerous
advantages over the legacy
mongo shell, such as:
- Improved syntax highlighting.
- Improved command history.
- Improved logging.
mongosh supports a subset of the
shell methods. Achieving feature parity between
mongosh and the
mongo shell is an ongoing effort.
To maintain backwards compatibility, the methods that
supports use the same syntax as the corresponding methods in the
mongo shell. To see the complete list of methods
MongoDB Shell Methods.