OptionsOn mongosh itself
-v--version
View your current mongosh version
--shell
Enables the shell interface. If you invoke the mongosh command and specify a JavaScript file as an argument, or use --eval to specify JavaScript on the command line, the --shell option provides the user with a shell prompt after the file finishes executing
--eval
Evaluates a JavaScript expression that is specified as an argument. mongosh does not load its own environment when evaluating code. As a result many options of the shell environment are not available. The result of evaluating a JavaScript argument is printed to your command line <javascript>
--help-h
Returns information on the options and use of the MongoDB Shell
--authenticationDatabase
Specifies the authentication database where the specified --username has been created. See Authentication Database <dbname>
--gssapiHostName
Specify the hostname of a service using GSSAPI/Kerberos. Only required if the hostname of a machine does not match the hostname resolved by DNS <hostname>
--gssapiServiceName
Specify the name of the service using GSSAPI/Kerberos. Only required if the service does not use the default name of mongodb <saslServiceName>
--password-p
Specifies a password with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the --username and --authenticationDatabase options <password>
--username-u
Specifies a username with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the --password and --authenticationDatabase options <username>
--retryWrites
Enables retryable writes as the default for sessions in the MongoDB Shell
--authenticationMechanism
Specifies the authentication mechanism the MongoDB Shell uses to authenticate to the mongod or mongos <authentication mechanism>
--nodb
Prevents the shell from connecting to any database instances
--norc
Prevents the shell from sourcing and evaluating ~/.mongoshrc.js on startup
--quiet
Skips all messages during startup (such as welcome messages and startup warnings) and goes directly to the prompt
--verbose
Increases the verbosity of the shell output during the connection process and when running commands
--port
Specifies the port where the mongod or mongos instance is listening. If --port is not specified, the MongoDB Shell attempts to connect to port 27017 <port>
--tls
Enables connection to a mongod or mongos that has TLS SSL support enabled
--tlsAllowInvalidHostnames
Disables the validation of the hostnames in the certificate presented by the mongod/mongos instance. Allows the MongoDB Shell to connect to MongoDB instances even if the hostname in the server certificates do not match the server's host
--tlsAllowInvalidCertificates
Bypasses the validation checks for the certificates presented by the mongod/mongos instance and allows connections to servers that present invalid certificates
--tlsDisabledProtocols
Disables the specified TLS protocols <protocols>
--tlsCAFile
Specifies the .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance <filePath>
--tlsCRLFile
Specifies the .pem file that contains the root certificate chain from the Certificate Authority. This file is used to validate the certificate presented by the mongod/mongos instance <filePath>
--tlsCertificateKeyFile
Enables connection to a mongod or mongos that has TLS SSL support enabled <filePath>