MongoDB for VS Code is currently available as a Preview in the Visual Studio Marketplace. The product, its features, and the corresponding documentation may change during the Preview stage.
This document lists the VS Code commands available for MongoDB for VS Code. To open the Command Palette and execute these commands:
Visual Studio Code Menu
View > Command Palette
Windows and Linux
mongodb in the Command Palette to display all of the
MongoDB for VS Code 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 MongoDB for VS Code 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.
You can configure multiple connections, but only have one active connection open at a time.
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 MongoDB for VS Code 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 MongoDB for VS Code.
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.
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
To launch your selected MongoDB shell, you must:
If you install a new version of your MongoDB shell, you will need to
Run these commands from the Command Palette to create and run playgrounds.
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.
MongoDB for VS Code 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, MongoDB for VS Code displays the playground results in a new tab to the right of your playground. If you manually move your playground results, MongoDB for VS Code displays the results in that tab.
Run these commands from the Command Palette to manage the MongoDB for VS Code view in the left navigation panel.