Docs Home / Compass / Customize

Configuration File Settings配置文件设置

You can use a configuration file to customize MongoDB Compass settings at startup. You cannot override any settings that have been set with a configuration file on the Compass interface.您可以在启动时使用配置文件自定义MongoDB Compass设置。您无法覆盖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定期检查新更新。
enableGenAIFeaturesAllow Compass to use generative AI for natural language querying. This feature requires an Atlas login and a deployed Atlas cluster.允许Compass使用生成式人工智能进行自然语言查询。此功能需要Atlas登录名和已部署的Atlas集群。
enableGenAISampleDocumentPassing

Allow MongoDB Compass to send sample field values with query and aggregation generation requests. These values can improve the results from the AI.允许MongoDB Compass通过查询和聚合生成请求发送示例字段值。这些值可以改善AI的结果。

If true, this setting implicitly sets the enableGenAIFeatures setting to true.如果为true,则此设置将enableGenAIFeatures设置隐式设置为true

enableDevTools

Enable Chrome DevTools in Compass.在Compass中启用Chrome DevTools。

To learn more, see Toggle Chrome DevTools.要了解更多信息,请参阅切换Chrome DevTools

enableMapsAllow Compass to make requests to third-party mapping services.允许Compass向第三方地图服务发出请求。
enableShell

Enable 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. These connection options cannot be overridden by connections from the Compass interface or a command line connection string.为通过Compass连接到MongoDB部署时分配连接选项值。这些连接选项不能被Compass界面的连接或命令行连接字符串覆盖。
ignoreAdditionalCommandLineFlagsAllow or disallow additional command-line option flags.允许或禁止其他命令行选项标志。
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上使用。

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执行除数据库外的传出网络操作。
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.如果启用了protectConnectionStrings,Compass将禁用“编辑连接字符串”选项并隐藏编辑连接字符串切换。

protectConnectionStringsForNewConnections

Sets connection strings for new connections as read-only by default. Passwords in new connection strings display as *****.默认情况下,将新连接的连接字符串设置为只读。新连接字符串中的密码显示为*****

If protectConnctionStringsForNewConnections 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.如果启用了protectConnctionStringsForNewConnections,Compass将禁用编辑连接字符串选项,但不会阻止用户使用编辑连接字符串切换手动启用该选项。

proxy

Enables you to specify or enforce the use of a proxy to connect to your deployment. For more information on connecting to your deployment with a proxy, see Proxy / SSH Tunnel Connection Tab.允许您指定或强制使用代理连接到部署。有关使用代理连接到部署的更多信息,请参阅代理/SSH隧道连接选项卡

You must pass either a URL or the following format:您必须传递URL或以下格式:

{
"proxy": "string",
"noProxyHosts": "string"
}

If you set proxy to an empty string, Compass does not use a proxy.如果将proxy设置为空字符串,Compass将不使用代理。

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密码字段

themeSpecify the MongoDB Compass UI theme. The supported themes are DARK, LIGHT, and OS_THEME.指定MongoDB Compass UI主题。支持的主题是DARKLIGHTOS_THEME
trackUsageStatistics

Allow Compass to send anonymous usage statistics.允许Compass发送匿名使用统计数据。

To learn more, see Configure Telemetry Options.要了解更多信息,请参阅配置遥测选项

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了解更多