# VS Code and the MongoDB Playground

To get the most out of MongoDB, you're going to need to become familiar with the MongoDB Query Language (MQL). No, it is not like SQL if you're familiar with relational database management systems (RDBMS), but it isn't any more difficult. MQL can be used from the CLI, Visual Studio Code, the development drivers, and more. You'll get the same experience no matter where you're trying to write your queries.

In this section, we're going to focus on Visual Studio Code and the [MongoDB Playground](https://docs.mongodb.com/mongodb-vscode/playgrounds) extension for managing our data. We're doing this because Visual Studio Code is common developer tooling and it makes for an easy to use experience.

## Configuring Visual Studio Code for the MongoDB Playground

While we could write our queries out of the box with Visual Studio Code, we won't be able to interact with MongoDB in a meaningful way until we install the [MongoDB Playground](https://docs.mongodb.com/mongodb-vscode/playgrounds) extension.

Within Visual Studio Code, bring up the extensions explorer and search for MongoDB (File > Preferences > Extensions).

Install the official extension with MongoDB as the publisher.

With the extension installed, we'll need to interact with it from within Visual Studio Code. There are a few ways to do this, but we're going to use the command palette.

Open the command pallette (CMD + SHIFT + P, if you're on macOS), and enter MongoDB: Connect into the input box.

You'll be able to enter the information for your particular MongoDB cluster. Once connected, we can proceed to creating a new Playground. If you've already saved your information into the Visual Studio Code extension and need to connect later, you can always enter Show MongoDB in the command pallette and connect.

Assuming we're connected, enter Create MongoDB Playground in the command pallette to create a new file with boilerplate MQL.

See the directory, `mongodb-playgorunds/` for existing scripts.

Within Visual Studio Code, you can highlight the MQL inside a script and choose Run Selected Lines From Playground or use the command pallette to run the entire playground (i.e. `MongoDB: Run All From Playground`). There is also a play button to the top-right of the editor when you have a playground `.mongodb` file open.

## References

* [Getting Started with Atlas and the MongoDB Query Language (MQL)](https://developer.mongodb.com/how-to/getting-started-atlas-mongodb-query-language-mql/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cody-burleson.gitbook.io/rock-mountain/developer-guide/database/vs-code-and-the-mongodb-playground.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
