Docs Menu

Triggers Overview

On this page

  • Trigger Types
  • Limitations
  • Realm Function Constraints Apply
  • Maximum Executions Per Second
  • Number of Triggers Cannot Exceed Available Change Streams

Realm Triggers execute application and database logic. Triggers can respond to events or use pre-defined schedules.

Triggers listen for events of a configured type. Each Trigger links to a specific Realm Function. When a Trigger observes an event that matches your configuration, it "fires." The Trigger passes this event object as the argument to its linked Function.

A Trigger might fire on:

  • A specific operation type in a given Collection.
  • An authentication event, such as user creation or deletion.
  • A scheduled time.

Realm keeps track of the latest execution time for each Trigger.

MongoDB Realm supports three types of triggers:

Triggers invoke Realm Functions. This means they have the same constraints as all Realm Functions.

Learn more about Realm Function constraints.

MongoDB Realm limits the execution of Trigger Functions. A Trigger can execute up to 2500 times per second. When a Trigger calls a Function, this call goes into a queue. When capacity becomes available, Realm executes the Function call.

Note

Your application's execution rate may be lower than 2500 per second. This varies depending on your Atlas instance size.

Database Triggers with event ordering work differently. Each ordered Trigger processes events in sequence. Realm waits for each event execution in the sequence to complete. Then, it handles the next event. Only one sequence for a given ordered Trigger executes at a time.

MongoDB Realm limits the total number of Database Triggers. The size of your Atlas cluster drives this limit.

Each Atlas cluster tier has a maximum number of supported change streams. A Database Trigger requires its own change stream. Other Realm services also use change streams, such as Realm Sync. Database Triggers may not exceed the number of available change streams.

Learn more about the number of supported change streams for MongoDB Atlas tiers.

←  TriggersDatabase Triggers →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.