
DocumentDB Read
CertifiedRead documents from DocumentDB
DocumentDB Read
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.
type: io.kestra.plugin.documentdb.ReadExamples
Find all users
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
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
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
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 *Requiredstring
Target collection
Collection inside the database where the action is performed.
database *Requiredstring
Target database
Database name used for the operation; expressions are rendered at runtime.
host *Requiredstring
DocumentDB endpoint
Base HTTPS endpoint for the DocumentDB REST API; trailing slash is trimmed before calling /data/v1/action/*.
password *Requiredstring
HTTP password
Basic-auth password for the DocumentDB API; prefer providing via secret.
username *Requiredstring
HTTP username
Basic-auth username for the DocumentDB API; prefer providing via secret.
aggregationPipeline array
Aggregation pipeline
MongoDB aggregation stages to run instead of a simple find. Overrides filter, skip, and limit.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEFetch 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 object
Filter
MongoDB-style filter for the find query, rendered at runtime. Leave empty to scan the full collection.
limit integerstring
Limit
Maximum number of documents to return; optional server-side cap.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
skip integerstring
Skip
Number of documents to skip before returning results.
Outputs
row object
First row
First matching document when fetchType is FETCH_ONE; null if no results.
rows array
Rows
All returned documents when fetchType is FETCH.
size integer
Returned document count
Number of documents fetched or stored.
uri string
uriResult file URI
URI in Kestra internal storage for the Ion result file; only set when fetchType is STORE.