Explore Your Data with Playgrounds


    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.

    MongoDB Playgrounds are JavaScript environments where you can prototype queries, aggregations, and MongoDB commands with helpful syntax highlighting.

    MongoDB Playgrounds provide intelligent autocomplete for:

    • The Mongo Shell API ,
    • MongoDB operators,
    • Database, collection, and field names.

    You can save playgrounds in your workspace and use them to document how your application interacts with MongoDB.


    You can also use your application to perform CRUD operations on documents using the appropriate driver. Playgrounds are meant to help you prototype database operations as you develop your application.


    To run a playground, you must connect to a MongoDB deployment using MongoDB for VS Code. To learn how to connect to a deployment, see Connect to Your MongoDB Deployment.

    Open a Playground

    To open a playground and begin interacting with your data:


    Open the Visual Studio Code Command Palette.

    In Visual Studio Code, press one of the following key combinations:

    • Control + Shift + P on Windows or Linux.
    • Command + Shift + P on macOS.

    The Command Palette provides quick access to commands and keyboard shortcuts.


    Find and run the "Create MongoDB Playground" command.

    Use the Command Palette search bar to search for commands. All commands related to MongoDB for VS Code are prefaced with MongoDB:.

    When you run the MongoDB: Create MongoDB Playground command, MongoDB for VS Code opens a playground pre-configured with a few commands.


    You can load new Playgrounds without the template by disabling the Use Default Template For Playground setting. To learn more about MongoDB for VS Code settings, see MongoDB for VS Code Settings.

    Your playground runs against the deployment specified in your active connection.


    Consideration for Authentication

    If your deployment requires authentication, your database user privileges may affect the actions you can perform using MongoDB for VS Code.