browse
mongosh/

MongoDB Shell

MongoDB

Modern interactive shell for MongoDB with syntax highlighting, autocompletion, and built-in help.

Databases & DataJSON
01Install
brew install mongosh
Download binary →

02Global Flags
FlagTypeDescription
--hoststringMongoDB server host
--portstringMongoDB server port
--username/-ustringAuthentication username
--password/-pstringAuthentication password
--evalstringEvaluate a JavaScript expression
--quietbooleanSuppress startup messages

03Authentication
Methods
connection-stringenvironment-variables
Env vars
MONGOSH_URIMONGODB_URI
Setupmongosh mongodb://localhost:27017

04Capabilities
Reference
binarymongosh
checkmongosh --version
authconnection-string, environment-variables
formatstext, ejson
json flag--json=relaxed