MongoDB Trigger

MongoDB Trigger

Certified

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.

yaml
type: io.kestra.plugin.mongodb.Trigger

Wait for a MongoDB query to return results, and then iterate through returned documents.

yaml
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
Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Collection name

MongoDB connection

Definitions
uri*Requiredstring

Connection string to MongoDB server

URL format like mongodb://mongodb0.example.com: 27017

Database name

Query filter

BSON string or map rendered before execution.

DefaultPT1M
Formatduration

Polling interval

Duration between queries; defaults to PT60S.

Limit

Maximum documents returned.

Projection

BSON string or map selecting fields to return.

Skip

Documents to skip before returning results.

Sort

BSON string or map defining sort order.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaultfalse

Store results

When true, writes results as Ion to internal storage; otherwise rows are kept in output. Defaults to false.

Defaulttrue

A 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.

Result rows

Present when store is false.

Rows fetched

Formaturi

Stored result URI

Internal storage URI when store is true.