DocumentDB Update

DocumentDB Update

Certified

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.

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: "john.doe@example.com"
    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

Target collection

Collection inside the database where the action is performed.

Target database

Database name used for the operation; expressions are rendered at runtime.

DocumentDB endpoint

Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.

HTTP password

Basic-auth password for the DocumentDB API; prefer providing via secret.

Update operations

Required MongoDB update document (e.g., $set, $inc), rendered before sending to the API.

HTTP username

Basic-auth username for the DocumentDB API; prefer providing via secret.

Filter query

MongoDB-style filter that selects documents to update. Rendered at runtime; an empty filter with updateMany updates all documents.

Reference (ref) of the pluginDefaults to apply to this task.

Defaultfalse

Update all matches

Set to true to update every document matching the filter; default false updates only the first match.

Matched document count

Number of documents that matched the filter.

Modified document count

Number of documents actually updated.

Upserted document ID

ID of the inserted document when upsert occurs; null otherwise.