Read documents from a DocumentDB collection.

Read documents from a DocumentDB collection with optional filtering, limiting, and aggregation support.

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: "[email protected]"
    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

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

Username

DocumentDB username for authentication

SubType object

Aggregation pipeline

MongoDB aggregation pipeline stages. If provided, this will execute an aggregation instead of a simple find.

Default FETCH
Possible Values
STOREFETCHFETCH_ONENONE

Fetch type

How to handle query results. STORE: store all rows to a file, FETCH: output all rows as output variable, FETCH_ONE: output the first row, NONE: do nothing

Filter

MongoDB-style filter criteria to apply to the query. Example: {"status": "active", "age": {"$gte": 18}}

Limit

Maximum number of documents to return

Skip

Number of documents to skip

Map containing the first row of fetched data

Only populated if fetchType is FETCH_ONE.

SubType object

List of map containing rows of fetched data

Only populated if fetchType is FETCH.

The number of documents returned by the operation

Format uri

The URI of the result file on Kestra's internal storage (.ion file / Amazon Ion formatted text file)

Only populated if fetchType is STORE.