Read documents from a DocumentDB collection.
Read documents from a DocumentDB collection with optional filtering, limiting, and aggregation support.
type: "io.kestra.plugin.documentdb.Read"Examples
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: "[email protected]"
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
Collection name
The name of the collection
database *Requiredstring
Database name
The name of the database
host *Requiredstring
DocumentDB host
The HTTP endpoint URL of your DocumentDB instance
password *Requiredstring
Password
DocumentDB password for authentication
username *Requiredstring
Username
DocumentDB username for authentication
aggregationPipeline array
Aggregation pipeline
MongoDB aggregation pipeline stages. If provided, this will execute an aggregation instead of a simple find.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEFetch 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 object
Filter
MongoDB-style filter criteria to apply to the query. Example: {"status": "active", "age": {"$gte": 18}}
limit integerstring
Limit
Maximum number of documents to return
skip integerstring
Skip
Number of documents to skip
Outputs
row object
Map containing the first row of fetched data
Only populated if fetchType is FETCH_ONE.
rows array
List of map containing rows of fetched data
Only populated if fetchType is FETCH.
size integer
The number of documents returned by the operation
uri string
uriThe URI of the result file on Kestra's internal storage (.ion file / Amazon Ion formatted text file)
Only populated if fetchType is STORE.