Trigger Trigger

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

Wait for query on a MongoDB collection.

Examples

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

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: "{{ json(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

collection

  • Type: string
  • Dynamic:
  • Required:

conditions

  • Type: array
  • SubType: Condition
  • Dynamic:
  • Required:

List of conditions in order to limit the flow trigger.

connection

database

  • Type: string
  • Dynamic:
  • Required:

filter

  • Type: object
  • Dynamic:
  • Required:

interval

  • Type: string
  • Dynamic:
  • Required:
  • Default: 60.000000000
  • Format: duration

Interval between polling.

The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.

limit

  • Type: integer
  • Dynamic:
  • Required:

projection

  • Type: object
  • Dynamic:
  • Required:

skip

  • Type: integer
  • Dynamic:
  • Required:

sort

  • Type: object
  • Dynamic:
  • Required:

stopAfter

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

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

store

  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false

Outputs

rows

  • Type: array
  • SubType:
  • Required:

List containing the fetched data.

Only populated if store parameter is set to false.

size

  • Type: integer
  • Required:

The number of rows fetched.

uri

  • Type: string
  • Required:
  • Format: uri

URI of the file containing the fetched results.

Only populated if store parameter is set to true.

Definitions

io.kestra.plugin.mongodb.MongoDbConnection

Properties

uri
  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Min length: 1

Connection string to MongoDB server.

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

Was this page helpful?