
DocumentDB Update
CertifiedUpdate documents in DocumentDB
DocumentDB Update
Update documents in DocumentDB
Apply Mongo-style update operators to matching documents. Defaults to updating one document; set updateMany to true to affect all matches. An empty filter with updateMany can update every document.
type: io.kestra.plugin.documentdb.UpdateExamples
Update a single user document
id: update_documentdb_user
namespace: company.documentdb
tasks:
- id: update_user
type: io.kestra.plugin.documentdb.Update
host: "https://my-documentdb-instance.com"
database: "myapp"
collection: "users"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
email: "john.doe@example.com"
update:
$set:
status: "active"
last_login: "{{ now() }}"
updateMany: false
Update multiple documents
id: update_multiple_users
namespace: company.documentdb
tasks:
- id: update_inactive_users
type: io.kestra.plugin.documentdb.Update
host: "https://my-documentdb-instance.com"
database: "myapp"
collection: "users"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
last_login:
$lt: "2023-01-01"
update:
$set:
status: "inactive"
archived_date: "{{ now() }}"
updateMany: true
Update with increment operation
id: increment_user_views
namespace: company.documentdb
tasks:
- id: increment_views
type: io.kestra.plugin.documentdb.Update
host: "https://my-documentdb-instance.com"
database: "myapp"
collection: "profiles"
username: "{{ secret('DOCUMENTDB_USERNAME') }}"
password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
filter:
user_id: "{{ inputs.user_id }}"
update:
$inc:
view_count: 1
total_interactions: 1
$set:
last_viewed: "{{ now() }}"
updateMany: false
Properties
collection *Requiredstring
Target collection
Collection inside the database where the action is performed.
database *Requiredstring
Target database
Database name used for the operation; expressions are rendered at runtime.
host *Requiredstring
DocumentDB endpoint
Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.
password *Requiredstring
HTTP password
Basic-auth password for the DocumentDB API; prefer providing via secret.
update *Requiredobject
Update operations
Required MongoDB update document (e.g., $set, $inc), rendered before sending to the API.
username *Requiredstring
HTTP username
Basic-auth username for the DocumentDB API; prefer providing via secret.
filter object
Filter query
MongoDB-style filter that selects documents to update. Rendered at runtime; an empty filter with updateMany updates all documents.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
updateMany booleanstring
falseUpdate all matches
Set to true to update every document matching the filter; default false updates only the first match.
Outputs
matchedCount integer
Matched document count
Number of documents that matched the filter.
modifiedCount integer
Modified document count
Number of documents actually updated.
upsertedId string
Upserted document ID
ID of the inserted document when upsert occurs; null otherwise.