
MongoDB Trigger
CertifiedPoll MongoDB and trigger on results
MongoDB Trigger
Poll MongoDB and trigger on results
Periodically runs a MongoDB find; if results are non-empty, starts a Flow with the rows or stored file. Uses Find task behavior (filter/projection/sort/limit/skip). Default interval is 60s and store is false, returning rows in trigger output.
type: io.kestra.plugin.mongodb.TriggerExamples
Wait for a MongoDB query to return results, and then iterate through returned documents.
id: mongodb_trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.ForEach
values: "{{ trigger.rows }}"
tasks:
- id: return
type: io.kestra.plugin.core.debug.Return
format: "{{ fromJson(taskrun.value) }}"
triggers:
- id: watch
type: io.kestra.plugin.mongodb.Trigger
interval: "PT5M"
connection:
uri: mongodb://root:example@localhost:27017/?authSource=admin
database: samples
collection: books
filter:
pageCount:
$gte: 50
sort:
pageCount: -1
projection:
title: 1
publishedDate: 1
pageCount: 1
Properties
allowConcurrent Non-dynamicboolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
collection string
Collection name
connection Non-dynamic
MongoDB connection
io.kestra.plugin.mongodb.MongoDbConnection
Connection string to MongoDB server
URL format like mongodb://mongodb0.example.com: 27017
database string
Database name
filter Non-dynamicobject
Query filter
BSON string or map rendered before execution.
interval Non-dynamicstring
PT1MdurationPolling interval
Duration between queries; defaults to PT60S.
limit integerstring
Limit
Maximum documents returned.
projection Non-dynamicobject
Projection
BSON string or map selecting fields to return.
skip integerstring
Skip
Documents to skip before returning results.
sort Non-dynamicobject
Sort
BSON string or map defining sort order.
stopAfter Non-dynamicarray
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
store booleanstring
falseStore results
When true, writes results as Ion to internal storage; otherwise rows are kept in output. Defaults to false.
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
rows array
Result rows
Present when store is false.
size integer
Rows fetched
uri string
uriStored result URI
Internal storage URI when store is true.