DocumentDB Read

DocumentDB Read

Certified

Read documents from DocumentDB

Query a collection with an optional filter, skip/limit, or aggregation pipeline. Results are rendered into the selected fetchType output; default FETCH returns all rows.

yaml
type: io.kestra.plugin.documentdb.Read

Find all users

yaml
id: read_all_users
namespace: company.documentdb

tasks:
  - id: find_users
    type: io.kestra.plugin.documentdb.Read
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    fetchType: FETCH

Find users with filter and limit

yaml
id: find_active_users
namespace: company.documentdb

tasks:
  - id: find_filtered_users
    type: io.kestra.plugin.documentdb.Read
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    filter:
      status: "active"
      age:
        $gte: 18
    limit: 100
    fetchType: FETCH

Get single user

yaml
id: get_single_user
namespace: company.documentdb

tasks:
  - id: find_one_user
    type: io.kestra.plugin.documentdb.Read
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    filter:
      email: "john.doe@example.com"
    fetchType: FETCH_ONE

Aggregation pipeline example

yaml
id: user_statistics
namespace: company.documentdb

tasks:
  - id: aggregate_users
    type: io.kestra.plugin.documentdb.Read
    connectionString: "{{ secret('DOCUMENTDB_CONNECTION_STRING') }}"
    database: "myapp"
    collection: "users"
    aggregationPipeline:
      - $match:
          status: "active"
      - $group:
          _id: "$department"
          count: { $sum: 1 }
          avgAge: { $avg: "$age" }
      - $sort:
          count: -1
    fetchType: FETCH
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.

SubTypeobject

Aggregation pipeline

MongoDB aggregation stages to run instead of a simple find. Overrides filter, skip, and limit.

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

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

Fetch type

Controls result handling (default FETCH). STORE writes all rows to Kestra internal storage as ION, FETCH outputs all rows, FETCH_ONE outputs only the first row, NONE skips output.

Filter

MongoDB-style filter for the find query, rendered at runtime. Leave empty to scan the full collection.

Limit

Maximum number of documents to return; optional server-side cap.

Skip

Number of documents to skip before returning results.

First row

First matching document when fetchType is FETCH_ONE; null if no results.

SubTypeobject

Rows

All returned documents when fetchType is FETCH.

Returned document count

Number of documents returned by the query, including when fetchType is NONE and results are not output.

Formaturi

Result file URI

URI in Kestra internal storage for the ION result file; only set when fetchType is STORE.