Docs Menu
Docs Home
/
MongoDB Compass
/

Command Line Options

On this page

  • Definition
  • Compass Executable Location
  • Syntax
  • Options
  • Learn More

You can customize MongoDB Compass using command line options.

You can start MongoDB Compass and set configuration options from the command line. When you use the command line to set configuration options, the options are set at startup. Settings configured using command line options cannot be modified on the Compass interface.

The name and location of the Compass executable varies by operating system.

Operating System
Executable Name
Location

Linux

mongodb-compass

The installer installs it in the /usr/bin directory.

Windows

MongoDBCompass.exe

The installer installs it in a folder you pick during the installation process.

MacOS

MongoDB Compass

The installer installs it under the Applications folder:

/Applications/MongoDB\ Compass.app/Contents/MacOS/MongoDB\ Compass

Use the following syntax to start MongoDB Compass and set a configuration option:

<path-to-Compass-executable> --<option>

These options can only be set on the command line. These options cannot be set in the Settings panel or the Compass configuration file.

Setting
Definition
--exportConnections

Export favorite connections.

--help

Show MongoDB Compass options.

--importConnections

Import favorite connections.

--passphrase

Specify a passphrase to encrypt the exported favorite connections output file.

Specify a passphrase to decrypt the imported favorite connections file.

--showExampleConfig

Provides an example Compass configuration file.

--trustedConnectionString

Suppresses warnings about disallowed connection string properties and allows automatic connection. Compass inspects the connection string passed in the command line, and verifies whether the connection string contains parameters that can result in a security risk.

Only set this option if you pass a known trusted connection string to Compass.

--version

Show MongoDB Compass version.

These options can be set on the command line, in a configuration file, or in the Settings panel. Setting an option on the command line overrides the value in the Settings panel.

Setting
Definition
--autoUpdates

Enable automatic updates. Use --no-autoUpdates to disable automatic updates.

--browserCommandForOIDCAuth

Specifies a shell command to start the browser for OIDC authentication when you connect to the server or log into your Atlas Cloud account.

--enableFeedbackPanel

Enable the feedback panel. Use --no-enableFeedbackPanel to disable automatic updates.

--enableDevTools

Enable Chrome DevTools in Compass.

To learn more, see Toggle Chrome DevTools.

--enableGenAIFeatures

Allow Compass to use generative AI for natural language querying. This feature requires an Atlas login and a deployed Atlas cluster.

--enableGenAISampleDocumentPassing

Allow MongoDB Compass to send sample field values with query and aggregation generation requests. These values can improve the results from the AI.

If true, this option implicitly sets the --enableGenAIFeatures option to true.

--enableMaps

Allow MongoDB Compass to make requests to a 3rd party mapping service. Use --no-enableMaps to disable mapping requests.

--enableShell

Enable or disable the embedded MongoDB Shell on Compass.

To learn more, see Disable the Embedded MongoDB Shell.

--file <file>

Specifies a file containing a list of connections that are automatically available once MongoDB Compass starts.

--forceConnectionOptions

Assign connection option values for when you connect to your MongoDB deployment through Compass. These connection options cannot be overridden by connections from the Compass interface or a command line connection string.

To learn more, see Specify Read Preference and Tags.

--ignoreAdditionalCommandLineFlags

Allows additional command line flags.

--installURLHandlers

Register Compass as a handler for mongodb:// and mongodb+srv:// URLs.

If Install Compass as URL Protocol Handler is enabled, you can open Compass by navigating to a mongodb:// or mongodb+srv:// URL in your internet browser.

Available on macOS and Windows.

--maxTimeMS

Specify an upper time limit for all Compass database operations.

--networkTraffic

Configure MongoDB Compass to only allow outgoing network operations to connect to the database.

To learn more, see Block Outgoing Network Connections.

--password

Specifies a password for authentication to Compass and the MongoDB deployment provided in the connection string.

Use in conjunction with --username.

--persistOIDCTokens

Allows you to remain logged in when using the MongoDB OIDC authentication mechanism for MongoDB server connections. Session tokens are encrypted and stored using the system keychain.

--protectConnectionStrings

Sets all connection strings as read-only. Passwords in connection strings display as *****.

If protectConnectionStrings is enabled, Compass disables the Edit connection string option and hides the Edit connection string toggle.

To learn more, see Hide Credentials in Your Connection String.

--protectConnectionStringsForNewConnections

Sets connection strings for new connections as read-only by default. Passwords in new connection strings display as *****.

If protectConnectionStringsForNewConnections is enabled, Compass disables the Edit connection string option but doesn't prevent users from manually enabling the option with the Edit connection string toggle.

--readOnly

Prevent users from performing write operations to your MongoDB deployment through Compass.

To learn more, see Restrict Write Operations to MongoDB.

--showInsights

Enables performance insights for your schemas and queries.

To learn more, see Performance Insights.

--showKerberosPasswordField

Show or hide the Kerberos password field on the Compass connection form.

To learn more, see Display the Kerberos Password Field.

--showOIDCDeviceAuthFlow

Enables device authorization flow for OIDC authentication on MongoDB server. This enables a less secure authentication flow that can be used as a fallback when browser-based authentication is unavailable.

--theme

Specify the MongoDB Compass UI theme. The supported themes are DARK, LIGHT, and OS_THEME.

--trackUsageStatistics

Enable sending usage statistics. Use --no-trackUsageStatistics to disable sending usage statistics.

To learn more, see Configure Telemetry Options.

--username

Specifies a username for authentication to Compass and the MongoDB deployment provided in the connection string

Optionally, use in conjuction with --password.

Note

To view all available Compass configuration options, run the following command in the folder containing your MongoDB Compass executable:

<path-to-Compass-executable> --help

Back

Interface Settings