Scheduled Triggers allow you to execute server-side logic on a regular schedule that you define. You can use scheduled Triggers to do work that happens on a periodic basis, such as updating a document every minute, generating a nightly report, or sending an automated weekly email newsletter.
Create a Scheduled Trigger¶
To create a scheduled Trigger in the Realm UI:
- Click Triggers under MongoDB Cluster in the left navigation menu.
- Select Scheduled Triggers from the Trigger type dropdown menu.
- Click Add a Trigger to open the Trigger configuration page.
Enter configuration values for the Trigger. You can configure two types of Trigger schedules: Basic or Advanced.
- A Basic schedule executes the Trigger periodically based on a single unit of time and an interval, such as "every five minutes" or "every Monday".
- An Advanced schedule executes the Trigger based on a custom CRON expression that you define.
- Click Save.
Scheduled Trigger Configuration¶
Scheduled Triggers have the following configuration parameters:
Required. The type of the Trigger.
For scheduled Triggers, this value should be set to
Required. The name of the Trigger.
Required. The name of the Realm Function that the Trigger executes whenever it fires.
A scheduled Trigger does not pass any arguments to its linked Function.
Required. The CRON expression that MongoDB Realm uses to determine when to fire the Trigger.