You can toggle the 您可以切换enableDevTools option to control user access to Chrome DevTools on MongoDB Compass. When you enable Chrome Devtools, you can view additional diagnostic or debugging information from the Compass interface.enableDevTools选项来控制用户对MongoDB Compass上Chrome DevTools的访问。启用Chrome Devtools后,您可以从Compass界面查看其他诊断或调试信息。
About This Task关于此任务
By default, Compass disables Chrome DevTools.默认情况下,Compass禁用Chrome DevTools。
Before you Begin开始之前
To use Chrome DevTools on Compass, you must enable the Enable MongoDB Shell option.要在Compass上使用Chrome DevTools,您必须启用“启用MongoDB Shell”选项。
If you enable any of the following options, you cannot enable the Enable DevTools setting:如果启用以下任何选项,则无法启用“启用DevTools”设置:
Set Read-Only Mode设置只读模式Upper Limit for maxTimeMS for Compass Database OperationsCompass数据库操作的maxTimeMS上限Protect Connection String Secrets保护连接字符串机密
Steps步骤
You can set the 您可以在以下任一位置设置enableDevTools option in either:enableDevTools选项:
The Compass Settings panelCompass设置面板The command line命令行A configuration file配置文件
Compass Settings PanelCompass设置面板
To open the MongoDB Compass Settings Panel, click the gear icon on the left column of the Compass home screen.要打开MongoDB Compass设置面板,请单击Compass主屏幕左列上的齿轮图标。

Alternatively, you can use keyboard shortcuts to open the Settings panel:或者,您可以使用键盘快捷键打开“设置”面板:
- Windows / Linux:
Ctrl+, - Mac:
⌘+,
Compass opens a dialog box where you can configure your MongoDB Compass settings.Compass打开一个对话框,您可以在其中配置MongoDB Compass设置。
Command Line命令行
The following command starts Compass from the command line and sets the 以下命令从命令行启动Compass并设置--enableDevTools option:--enableDevTools选项:
<path-to-Compass-executable> --enableDevTools
Note
The name and filepath of the Compass executable depend on your operating system.Compass可执行文件的名称和文件路径取决于您的操作系统。
Configuration File配置文件
You can specify the Compass configuration file in either EJSON or YAML format. The following configurations set the 您可以以EJSON或YAML格式指定Compass配置文件。以下配置将enableDevTools option to true:enableDevTools选项设置为true:
EJSON
{ "enableDevTools": true }YAML
enableDevTools: trueLearn More了解更多
To learn more about the MongoDB Compass configuration file, see Configuration File Settings.要了解有关MongoDB Compass配置文件的更多信息,请参阅配置文件设置。