On this page
App Services 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 App Services 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.
App Services keeps track of the latest execution time for each Trigger.
Atlas App Services supports three types of triggers:
Triggers invoke App Services Functions. This means they have the same constraints as all App Services Functions.
Atlas App Services 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, App Services executes the Function call.
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. App Services 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.
Atlas App Services 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 App Services services also use change streams, such as Atlas Device Sync. Database Triggers may not exceed the number of available change streams.