mongosh
modern MongoDB shell
TLDR
SYNOPSIS
mongosh [options] [connectionstring] [filenames]
DESCRIPTION
mongosh is the modern MongoDB shell, providing a fully functional JavaScript and Node.js REPL environment for interacting with MongoDB deployments.It replaces the legacy mongo shell with improvements including syntax highlighting, intelligent autocomplete, inline help, and extensible snippets. It supports all CRUD operations, aggregation pipelines, database administration, and Atlas connectivity.
PARAMETERS
CONNECTIONSTRING_
MongoDB connection URI.-u USER
Username for authentication.-p PASSWORD
Password for authentication.--eval EXPR
Evaluate JavaScript expression.--nodb
Start without database connection.--quiet
Silence non-essential output.--host HOST
Server hostname (default: localhost).--port PORT
Server port (default: 27017).--authenticationDatabase DB
Authentication database (default: admin).--tls
Enable TLS/SSL connection.--shell
Force interactive shell after running files/eval.--help
Display help information.
CAVEATS
Bundles its own Node.js runtime since version 1.0. Compatible with MongoDB 4.0+, though some features require MongoDB 5.0+. Has a different driver API from the legacy mongo shell; scripts may need updating.
HISTORY
mongosh was released by MongoDB in 2020 as the next-generation shell replacement for the legacy mongo shell.
SEE ALSO
mongo(1), mongod(1), mongoimport(1), mongoexport(1), mongodump(1)
