Docs Home → MongoDB Compass
Command Line Options命令行选项
You can customize MongoDB Compass using command line options.您可以使用命令行选项自定义MongoDB Compass。
Definition定义
You can start MongoDB Compass and set configuration options from the command line. 您可以启动MongoDB Compass并从命令行设置配置选项。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.无法在Compass界面上修改使用命令行选项配置的设置。
Compass Executable LocationCompass可执行位置
The name and location of the Compass executable varies by operating system.Compass可执行文件的名称和位置因操作系统而异。
Operating System操作系统 | Executable Name可执行文件名称 | Location地方 |
Linux | mongodb-compass | The installer installs it in the /usr/bin directory.安装程序将其安装在/usr/bin 目录中。 |
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文件夹下:
/Applications/MongoDB\ Compass.app/Contents/MacOS/MongoDB\ Compass |
Syntax语法
Use the following syntax to start MongoDB Compass and set a configuration option:使用以下语法启动MongoDB Compass并设置配置选项:
<path-to-Compass-executable> --<option>
Options选项
Command Line Only仅限命令行
These options can only be set on the command line. 这些选项只能在命令行上设置。These options cannot be set in the Settings panel or the Compass configuration file.无法在“设置”面板或Compass配置文件中设置这些选项。
Setting背景 | Definition释义 |
--exportConnections | Export favorite connections.导出喜爱的连接。 |
--file <file> | Specify a file containing a list of connections. 指定一个包含连接列表的文件。These connections are automatically available once MongoDB Compass starts.一旦MongoDB Compass启动,这些连接就会自动可用。 |
--help | Show MongoDB Compass options.显示MongoDB Compass选项。 |
--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.指定密码短语以解密导入的收藏夹连接文件。 |
--version | Show MongoDB Compass version.显示MongoDB Compass版本。 |
General Settings通用设置
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.使用--no-autoUpdates 可禁用自动更新。 |
--enableFeedbackPanel | Enable the feedback panel. 启用反馈面板。Use --no-enableFeedbackPanel to disable automatic updates.使用--no-enableFeedbackPanel 禁用自动更新。 |
--enableDevTools | Enable Chrome DevTools in Compass.在Compass中启用Chrome DevTools。
To learn more, see Toggle Chrome DevTools.要了解更多信息,请参阅切换Chrome开发工具。 |
--enableMaps | Allow MongoDB Compass to make requests to a 3rd party mapping service. 允许MongoDB Compass向第三方映射服务发出请求。Use --no-enableMaps to disable mapping requests.使用--no-enableMaps 禁用映射请求。 |
--enableShell | Enable or disable the embedded MongoDB Shell on Compass.启用或禁用Compass上的嵌入式MongoDB Shell。
To learn more, see Disable the Embedded MongoDB Shell.要了解更多信息,请参阅禁用嵌入式MongoDB Shell。 |
--forceConnectionOptions | Assign connection option values for when you connect to your MongoDB deployment through Compass. 当您通过Compass连接到MongoDB部署时,为分配连接选项值。These connection options cannot be overridden by connections from the Compass interface or a command line connection string.这些连接选项不能被来自Compass界面或命令行连接字符串的连接覆盖。
To learn more, see Specify Read Preference and Tags.要了解更多信息,请参阅指定读取首选项和标记。 |
--installURLHandlers | Register Compass as a handler for mongodb:// and mongodb+srv:// URLs.将Compass注册为mongodb://和mongodb+srv://URL的处理程序。
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.如果启用了“将Compass安装为URL协议处理程序”,则可以通过导航到internet浏览器中的mongodb://或mongodb+srv://URL来打开Compass。
Available on macOS and Windows.可在macOS和Windows上使用。 |
--maxTimeMS | Specify an upper time limit for all Compass database operations.指定所有Compass数据库操作的时间上限。 |
--networkTraffic | Configure MongoDB Compass to only allow outgoing network operations to connect to the database.将MongoDB Compass配置为仅允许传出网络操作连接到数据库。
To learn more, see Block Outgoing Network Connections.要了解更多信息,请参阅阻止传出网络连接。 |
--protectConnectionStrings | Hide credentials in your connection string. Passwords in connection strings are displayed as ***** 隐藏连接字符串中的凭据。连接字符串中的密码显示为*****
To learn more, see Hide Credentials in Your Connection String.要了解更多信息,请参阅在连接字符串中隐藏凭据。 |
--readOnly | Prevent users from performing write operations to your MongoDB deployment through Compass.防止用户通过Compass对您的MongoDB部署执行写操作。
To learn more, see Restrict Write Operations to MongoDB.要了解更多信息,请参阅将写入操作限制到MongoDB。 |
--showKerberosPasswordField | Show or hide the Kerberos password field on the Compass connection form.显示或隐藏Compass连接表单上的Kerberos密码字段。
To learn more, see Display the Kerberos Password Field.要了解更多信息,请参阅显示Kerberos密码字段。 |
--theme | Specify the MongoDB Compass UI theme. 指定MongoDB Compass UI主题。The supported themes are DARK , LIGHT , and OS_THEME .支持的主题为“DARK”、“LIGHT”和“OS_THEME”。 |
--trackUsageStatistics | Enable sending usage statistics. 启用发送使用情况统计信息。Use --no-trackUsageStatistics to disable sending usage statistics.使用--no-trackUsageStatistics 可禁用发送使用情况统计信息。 |
Note
To view all available Compass configuration options, run the following command in the folder containing your MongoDB Compass executable:要查看所有可用的Compass配置选项,请在包含MongoDB Compass可执行文件的文件夹中运行以下命令:
<path-to-Compass-executable> --help