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
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    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
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    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

inputs:
  - id: user_id
    type: STRING
    defaults: user-123

tasks:
  - id: increment_views
    type: io.kestra.plugin.documentdb.Update
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "profiles"
    filter:
      user_id: "{{ inputs.user_id }}"
    update:
      $inc:
        view_count: 1
        total_interactions: 1
      $set:
        last_viewed: "{{ now() }}"
    updateMany: false
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-documentdb --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.

Properties

Target collection

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

Target database

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

Update operations

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

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

CA certificate

PEM-encoded CA certificate used to verify the TLS connection to DocumentDB.

Amazon DocumentDB connection string

Recommended connection URI for Amazon DocumentDB, consumed by the MongoDB Java Driver, for example: mongodb://: @.docdb.amazonaws.com: 27017/?tls=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false

Filter query

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

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.