Docs HomeMongoDB Compass

Configuration File Settings配置文件设置

You can use a configuration file to customize MongoDB Compass settings at startup. 您可以在启动时使用配置文件自定义MongoDB Compass设置。You cannot override any settings that have been set with a configuration file on the Compass interface.您不能覆盖在Compass界面上使用配置文件设置的任何设置。

Configuration File Location配置文件位置

  • For macOS and Linux, the configuration file is located at /etc/mongodb-compass.conf.对于macOS和Linux,配置文件位于/etc/mongodb-compass.conf
  • For Windows, the configuration file is located at <path\to\compass>\..\mongodb-compass.cfg.对于Windows,配置文件位于<path\to\compass>\..\mongodb-compass.cfg

Syntax语法

You can configure Compass configuration file settings in either EJSON or YAML format.您可以以EJSON或YAML格式配置Compass配置文件设置。

EJSON

{
"setting": value,
"setting": value,
...
}

YAML

setting option:value
setting option: value
...

Settings设置

Setting设置Definition定义
autoUpdatesAllow Compass to periodically check for new updates.允许Compass定期检查新的更新。
enableDevtoolsEnable Chrome DevTools in Compass.在Compass中启用Chrome DevTools。
To learn more, see Toggle Chrome DevTools.要了解更多信息,请参阅切换Chrome开发工具
enableMapsAllow Compass to make requests to third-party mapping services.允许Compass向第三方映射服务发出请求。
enableShellEnable or disable the embedded MongoDB Shell on Compass.启用或禁用Compass上的嵌入式MongoDB Shell。
To learn more, see Disable the Embedded MongoDB Shell.要了解更多信息,请参阅禁用嵌入式MongoDB Shell
forceConnectionOptionsAssign 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界面或命令行连接字符串的连接覆盖。
ignoreAdditionalCommandLineFlagsAllow or disallow additional command-line option flags.允许或不允许其他命令行选项标志。
installURLHandlersRegister 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上使用。

maxTimeMSSpecify an upper time limit for all Compass database operations.指定所有Compass数据库操作的时间上限。
networkTrafficPrevent MongoDB Compass from performing outgoing network operations other than those to the database.阻止MongoDB Compass执行除数据库之外的传出网络操作。
protectConnectionStringsHide credentials in your connection string. Passwords in connection strings are displayed as *****隐藏连接字符串中的凭据。连接字符串中的密码显示为*****
readOnlyPrevent users from performing write operations to your MongoDB deployment through Compass.防止用户通过Compass对您的MongoDB部署执行写操作。
To learn more, see Restrict Write Operations to MongoDB.要了解更多信息,请参阅将写入操作限制到MongoDB
showKerberosPasswordFieldShow or hide the Kerberos password field on the Compass connection form.显示或隐藏Compass连接表单上的Kerberos密码字段。
To learn more, see Display the Kerberos Password Field.要了解更多信息,请参阅显示Kerberos密码字段
themeSpecify the MongoDB Compass UI theme. 指定MongoDB Compass UI主题。The supported themes are DARK, LIGHT, and OS_THEME.支持的主题为“DARK”、“LIGHT”和“OS_THEME”。
trackUsageStatisticsAllow Compass to send anonymous usage statistics.允许Compass发送匿名使用统计信息。
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

Example实例

To view a sample Compass configuration file, run the following command:要查看Compass配置文件示例,请运行以下命令:

<path-to-Compass-executable> --show-example-config

If you do not already have a configuration file, run the following command to create a configuration file that uses the sample configuration settings:如果您还没有配置文件,请运行以下命令创建一个使用示例配置设置的配置文件:

<path-to-Compass-executable> --show-example-config > /etc/mongodb-compass.conf

Learn More了解更多信息