Azure Cosmos DB

◷ Reading Time: 2 minutes

This extension enables you to interact with documents in Cosmos DB.

Connecting to your Database

The Data Source argument requires you to pass in a string value with the details of your connection. The following example uses the Cosmos DB emulator. Replace the values with your own.

endpoint=https://localhost:8081;masterKey=YourKey;database=YourDatabase;collection=YourDocs

Partition Keys

If your collection uses a partition key, this must be passed either through your Data Source or through the Partition Key argument for your action. If you pass both, the partition key passed in as an argument for your action will be used.

You can use@.YourPartitionKey if you want to use a value passed in through the document content. E.g. @.Department would look for a key value pair where the key is Department. This must match the collection’s partition key.

Create Document

Creates a document in your collection.

  • Data Source: connection string to your collection.
  • Document Content: your JSON document’s content.
  • Partition Key: The partition key to use for your document.

Query Documents

Runs a SQL query against the documents in your collection.

  • Data Source: connection string to your collection.
  • SQL Query: CosmosDB compatible SQL query to run.
  • Partition Key: The partition key to use for your document.
  • returns: JSON of query results.

Update Document

Updates a document in your collection.

  • Data Source: connection string to your collection.
  • Document Content: your JSON document’s content.
  • Document ID: The document ID for your document in the collection.
  • Partition Key: The partition key to use for your document.

Delete Document

Deletes a document in your collection.

  • Data Source: connection string to your collection.
  • Document ID: The document ID for your document in the collection.
  • Partition Key: The partition key to use for your document.
Updated on May 11, 2022

Was this article helpful?

Related Articles