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
    host: "https://my-documentdb-instance.com"
    database: "myapp"
    collection: "users"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    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
    host: "https://my-documentdb-instance.com"
    database: "myapp"
    collection: "users"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    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
    host: "https://my-documentdb-instance.com"
    database: "myapp"
    collection: "users"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    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
    host: "https://my-documentdb-instance.com"
    database: "myapp"
    collection: "users"
    username: "{{ secret('DOCUMENTDB_USERNAME') }}"
    password: "{{ secret('DOCUMENTDB_PASSWORD') }}"
    aggregationPipeline:
      - $match:
          status: "active"
      - $group:
          _id: "$department"
          count: { $sum: 1 }
          avgAge: { $avg: "$age" }
      - $sort:
          count: -1
    fetchType: FETCH
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.

HTTP username

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

SubTypeobject

Aggregation pipeline

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

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.

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

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 fetched or stored.

Formaturi

Result file URI

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