Update
Update documents in a DocumentDB collection.
Update one or more documents in a DocumentDB collection that match the filter criteria.
type: "io.kestra.plugin.documentdb.Update"Examples
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: "[email protected]"
    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
Collection name
The name of the collection
database *Requiredstring
Database name
The name of the database
host *Requiredstring
DocumentDB host
The HTTP endpoint URL of your DocumentDB instance
password *Requiredstring
Password
DocumentDB password for authentication
update *Requiredobject
Update operations
MongoDB-style update operations to apply. Example: {"$set": {"status": "active"}, "$inc": {"count": 1}}
username *Requiredstring
Username
DocumentDB username for authentication
filter object
Filter criteria
MongoDB-style filter to select which documents to update. Example: {"status": "pending", "age": {"$gte": 18}}
updateMany booleanstring
falseUpdate multiple documents
If true, updates all documents matching the filter (updateMany). If false, updates only the first match (updateOne).
Outputs
matchedCount integer
Number of documents matched
Total count of documents that matched the filter criteria
modifiedCount integer
Number of documents modified
Total count of documents that were actually modified
upsertedId string
Upserted document ID
ID of the document that was created if upsert was enabled and no match was found