Edit

Perform CRUD operations on Azure Cosmos DB documents and collections in Visual Studio Code

What this feature does

Use the extension to:

  • Create and view documents.
  • Edit and delete documents.
  • Perform collection-level actions from context menus.

Open documents in a container

  1. In the Azure view, expand your Azure Cosmos DB account.
  2. Expand the target database and container.
  3. Open the documents or items view for that container.

Azure Cosmos DB items view in Visual Studio Code with document list and JSON editor for create, edit, and delete operations.

Create a document

  1. Select the action to add a new document.
  2. Enter JSON that includes required fields such as id and partition key.
  3. Save and verify the new item appears in the container list.

Edit a document

  1. Open an existing document.
  2. Modify fields in the JSON payload.
  3. Save changes and verify update behavior in the list or query results.

Delete documents

  1. Select one or more documents.
  2. Choose the delete action.
  3. Confirm deletion and verify results.

Best practices

  • Avoid changing partition key values for existing documents.
  • Use focused queries to confirm updates before and after edits.
  • Make bulk changes through controlled scripts when document count is high.