Azure Cosmos DB (SDK)

Interact with Azure Cosmos DB using the official SDK (supports vector search and hybrid queries)

Insert

AI-generated

Summary

Insert a new document into Azure Cosmos DB

Inputs

  • authenticationType — The authentication method to use (master key or Microsoft Entra ID)
  • databaseName (required) — The name of the Cosmos DB database
  • containerName (required) — The name of the Cosmos DB container
  • document (required) — The document to insert as JSON. Must include an ID field.

Output shape

a single record containing the inserted document's JSON

The operation returns the created document; errors are thrown as NodeOperationError and are not returned as data.

Examples

Example 1: Insert a product record

Authentication Type = Master Key, Database Name = products, Container Name = items, Document = {"id": "prod-001", "name": "Widget", "price": 19.99}

Discussion