UPSERT
CosmosDB NoSQL Plugin – Upsert Action
Summary (SEO Meta Description):
The Upsert Action of the CosmosDB NoSQL Plugin enables WeHub workflows to insert a new document or update it if it already exists in an Azure Cosmos DB container.
This action simplifies data management by combining insert and update operations.
Overview
The Upsert Action lets WeHub create or update documents in a Cosmos DB container with a single operation.
If the document with the given partition key already exists, it will be updated; otherwise, a new document will be inserted.
Typical Use Cases:
- Automatically maintain user profiles without checking if a record exists
- Synchronize IoT sensor readings that frequently change
- Simplify data ingestion pipelines where document presence is uncertain
⚙️ Configuration
| Field | Description | Type / Options | 
|---|---|---|
| Label | Custom name for the action | String | 
| Select connection | Choose or create a secure connection to Azure Cosmos DB | Connection | 
| Partition Key | Partition key for the document to be upserted | String | 
| Container name | Target Cosmos DB container | Dropdown | 
| Inputs (Manual) | Define input fields for the document | Key–Value pairs (Types: NUMBER, STRING, BYTE, DATE, DATETIME, BOOLEAN, OBJECT, ARRAY, ANY) | 
| Schema | Select or define schema for document structure | Schema | 
| Truncate Fields | Toggle to limit or truncate large field values during processing | Boolean | 
FAQ
Q: What happens if the document does not exist?
A: Cosmos DB will insert a new document using the provided partition key.
Q: Can I control which fields are updated when a document exists?
A: Yes, only the provided fields will be updated; other fields remain unchanged.
Q: Does WeHub log or store my data?
A: No. WeHub securely processes the data and does not log document contents.
Keywords: WeHub CosmosDB NoSQL Plugin, Upsert Action, Azure Cosmos DB Insert or Update, NoSQL Data Upsert, Partition Key