Navigation

Perform CRUD Operations

Info With Circle IconCreated with Sketch.Note
Preview

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.

Documents are individual records in a MongoDB collection and are the basic unit of data in MongoDB.

You can use a MongoDB Playground to perform CRUD (create, read, update, and delete) operations on documents in a collection on a connected deployment.

Use the MongoDB CRUD Operators and shell methods to interact with your databases in MongoDB Playgrounds.

Info With Circle IconCreated with Sketch.Note

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.

Before you can create, read, update, and delete documents using a MongoDB Playground, you must open one.

1

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.

2

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.

Info With Circle IconCreated with Sketch.Note

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.

Give Feedback