Update documents in a DocumentDB collection.

Update one or more documents in a DocumentDB collection that match the filter criteria.

yaml
type: "io.kestra.plugin.documentdb.Update"

Update a single user document

yaml
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

yaml
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

yaml
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 name

The name of the collection

Database name

The name of the database

DocumentDB host

The HTTP endpoint URL of your DocumentDB instance

Password

DocumentDB password for authentication

Update operations

MongoDB-style update operations to apply. Example: {"$set": {"status": "active"}, "$inc": {"count": 1}}

Username

DocumentDB username for authentication

Filter criteria

MongoDB-style filter to select which documents to update. Example: {"status": "pending", "age": {"$gte": 18}}

Default false

Update multiple documents

If true, updates all documents matching the filter (updateMany). If false, updates only the first match (updateOne).

Number of documents matched

Total count of documents that matched the filter criteria

Number of documents modified

Total count of documents that were actually modified

Upserted document ID

ID of the document that was created if upsert was enabled and no match was found