Cosmos DB icon

Cosmos DB

Cosmos DB Node - Upsert documents to Azure Cosmos DB

Item → Create or Update

AI-generated

Summary

Upserts each JSON document into the selected Cosmos DB container, creating it if it does not exist or replacing it if it does. You can optionally merge metadata, add text, or generate an embedding vector before the upsert.

Inputs

  • Authentication Type (required) — Choose Master Key or Microsoft Entra ID (Azure AD) credentials. Alternatively, enable the dev override and provide both a Cosmos DB endpoint and bearer token.
  • Database Name or ID (required) — Select or enter the target database ID; expressions are supported.
  • Container Name or ID (required) — Select or enter the target container ID; expressions are supported.
  • Item Content (required) — JSON document to upsert. It must include an id and a non-empty value for the container's partition key field.
  • Add Metadata — When enabled, the configured key/value pairs are merged into the document's metadata object, preserving other metadata fields.
  • Add Embedding — When enabled, connect an Embeddings node and provide the text to embed and the document field name for the generated vector.
  • Add Text — When enabled, provide text content and the document field name where it will be stored.

Output shape

A list of items, one per upserted document, each containing the Cosmos DB resource returned by the upsert (or the submitted document if no resource is returned).

Consecutive input items configured for Create or Update are processed in a batch; output items retain their input-item pairing. Errors stop execution unless Continue On Fail is enabled, in which case an item with an error field is returned.

Links

Discussion