MongoDB for VS Code Settings设置

On this page本页内容

Note
Preview预览

MongoDB for VS Code is currently available as a Preview in the Visual Studio Marketplace.MongoDB for VS Code目前在Visual Studio Marketplace中作为预览版提供。The product, its features, and the corresponding documentation may change during the Preview stage.在预览阶段,产品、其功能和相应的文档可能会更改。

This document lists the configurable settings for MongoDB for VS Code.本文档列出了MongoDB for VS Code的可配置设置。

To configure MongoDB for VS Code settings:要为VS Code设置配置MongoDB:

1
Operating System操作系统 Method方法 Actions操作
Any Visual Studio Code Menu File / Code > Preferences > Settings
MacOS Keyboard Shortcut键盘快捷键 Press Command + ,
Windows and Linux Keyboard Shortcut键盘快捷键 Press Ctrl + ,
2

MongoDB for VS Code extension settings are displayed.显示MongoDB for VS Code扩展设置。Changes you make are saved automatically.您所做的更改将自动保存。

The following table lists the available settings for MongoDB for VS Code:下表列出了MongoDB for VS Code的可用设置:

Setting设置 Description描述 Default默认值
Shell

MongoDB shell to use.要使用的MongoDB shell。Choose either:选择以下任一项:

  • mongo (the legacy MongoDB shell), or(遗留的MongoDB shell),或
  • mongosh (the new MongoDB shell)(新的MongoDB shell)
Important

To launch your selected MongoDB shell, you must:要启动选定的MongoDB shell,必须:

  • Install the shell you want to use, and安装要使用的外壳,然后
  • Configure your machine's PATH environment variable to include the filepath to your shell binary.配置您的计算机的PATH环境变量,以包括shell二进制文件的文件路径。

If you install a new version of your MongoDB shell, you will need to update your PATH variable to reference the new version.如果安装新版本的MongoDB shell,则需要更新PATH变量以引用新版本。

Tip
See Also:另请参见:
mongo
Show If enabled, shows the MongoDB view in the Visual Studio Code left navigation panel.如果启用,则在Visual Studio Code左侧导航面板中显示MongoDB视图。 Enabled
Max Number of Problems The maximum number of problems MongoDB for VS Code will generate in the Visual Studio Code Problems view.MongoDB for VS Code将在Visual Studio Code问题视图中生成的最大问题数。 100
Trace: Server

MongoDB language server logging settings.MongoDB语言服务器日志记录设置。

Edit this setting through the mongodbLanguageServer.trace.server property in your project's settings.json file.通过项目的settings.json文件中的mongodbLanguageServer.trace.server属性编辑此设置。

Within the mongodbLanguageServer.trace.server object, you can specify:mongodbLanguageServer.trace.server对象中,你可以指定:

  • format, and
  • verbosity

Output logs are viewable by selecting MongoDB Language Server from the dropdown in the Output view, or with the Language Server Protocol Inspector.通过从输出视图的下拉列表中选择MongoDB语言服务器,或者使用语言服务器协议检查器,可以查看输出日志。

{
 "format": "json",
 "verbosity": "verbose"
}
Confirm Run All If enabled, shows a confirmation message before running commands in a playground.如果启用,将在演练场上运行命令之前显示确认消息。 Enabled
Default Connection Saving Location

Sets if and where new connections are saved.设置是否以及在何处保存新连接。

You can select:您可以选择:

Setting设置 Description描述
Global Save your connection globally in VS Code, so it can be accessed from any workspace.在VS Code中全局保存连接,以便可以从任何工作区访问它。
Workspace Save your connection in your workspace.在工作区中保存连接。You cannot access the connection from a different workspace.无法从其他工作区访问连接。
Session Save the connection for only this VS Code session.仅针此VS Code会话保存连接。The connection is lost when you close VS Code.关闭VS Code时,连接将丢失。
Global
Hide Option To Choose Where To Save New Connections

If disabled, you are prompted to choose where to save each new connection.如果禁用,系统将提示您选择保存每个新连接的位置。

If enabled, new connections are automatically saved to the Default Connection Saving Location without prompt.如果启用,新连接将自动保存到默认的连接保存位置,而不会出现提示。

Enabled
Default Limit Number of documents to fetch when viewing documents from a collection.从集合中查看文档时要获取的文档数。Does not affect playground operations.不影响演练场操作。 10
Send Telemetry If enabled, allows the collection of anonymous diagnostic and usage telemetry data to help improve MongoDB for VS Code.如果启用,则允许收集匿名诊断和使用情况遥测数据,以帮助改进MongoDB for VS Code。 Enabled
Use Default Template For Playground

If enabled, playground files load with a template containing sample commands.如果启用,则演练场文件将与包含示例命令的模板一起加载。

If disabled, playground files load with an empty playground editor.如果禁用,将使用空的演练场编辑器加载演练场文件。

Enabled
MongoDB for VS Code Commands命令