Docs Menu
Docs Home
/ /

Visual Studio Code Commands

This document lists the VS Code commands available for VS Code Extension. To open the Command Palette and execute these commands:

Operating System
Method
Actions

Any

Visual Studio Code Menu

View > Command Palette

MacOS

Keyboard Shortcut

Press Command + Shift + P

Windows and Linux

Keyboard Shortcut

Press Control + Shift + P

Tip

Enter mongodb in the Command Palette to display all of the VS Code Extension commands you can use.

Run these commands from the Command Palette to create new connections or manage existing connections to your MongoDB deployments.

Configuring a new connection adds a new entry to your Connections list in the VS Code Extension view. Select a connection from the list to activate that connection.

To learn more about connecting to a deployment, see Connect to Your MongoDB Deployment.

Note

You can configure multiple connections, but only have one active connection open at a time.

Command
Description

Connect to your MongoDB deployment by filling in your connection information in the connection dialog.

Connect to your MongoDB deployment by pasting your connection string URI directly into the command palette. Connecting to a deployment adds a new entry to your Connections list in the VS Code Extension view.

Atlas provides a connection string for your clusters which you can pass into this command.

Disconnect from your active deployment connection.

Select and remove a connection from your list of connections in VS Code Extension.

Removing your current active connection also closes that connection.

Run this command from the Command Palette to open a MongoDB Shell connected to your deployment.

Command
Description

IMPORTANT: This command is not supported on Windows.

Open the VS Code Terminal and automatically connect a MongoDB shell to the deployment specified in your active connection.

Specify the MongoDB shell to use in the mdb.shell setting. VS Code Extension supports the following shells:

  • Legacy mongo shell

  • mongosh shell.

To launch your selected MongoDB shell, you must:

  • Install the shell you want to use, and

  • Configure your machine's PATH environment variable to include the filepath to your shell binary.

If you install a new version of your MongoDB shell, you will need to update your PATH variable to reference the new version.

Run these commands from the Command Palette to create and run playgrounds.

Command
Description

Create a new playground to run against your MongoDB deployment.

By default, playgrounds load with a template containing sample commands. You can disable this template from your extension settings.

Run file you are currently viewing in VS Code as a playground. Your playground runs against the deployment specified in your active connection.

VS Code Extension splits your playground window to display the results in a pane titled Playground Results.json to the right of your playground. If you disabled split-view for your VS Code Editor window, VS Code Extension displays the playground results in a new tab to the right of your playground. If you manually move your playground results, VS Code Extension displays the results in that tab.

Run these commands from the Command Palette to manage the VS Code Extension view in the left navigation panel.

Command
Description

Open and focus on the VS Code Extension view.

If VS Code Extension is hidden from your extension view, show it.

Run these commands from the Command Palette to manage the MongoDB MCP server.

Command
Description

Start MCP Server

Manually starts the MCP server if it isn't already running.

Note

By default, the MCP server automatically starts when you connect to your MongoDB deployment. To disable automatic startup, set the mdb.mcp.server setting to disabled.

Stop MCP Server

Stops the MCP server.

Note

Stopping the MCP server using this command is not enough to prevent the MCP server from automatically starting on the next editor restart. To disable automatic startup, you must also configure the mdb.mcp.server setting in the VS Code Extension settings.

Get MCP Server Config

Opens a temporary JSON file containing the current URL and security headers needed to connect to the MCP server.

To learn more about configuring the MongoDB MCP server, see MongoDB MCP Server Configuration.

Back

Create an Atlas Cluster with Terraform

On this page