Navigation

Scheduled Triggers

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.

To create a scheduled Trigger in the Realm UI:

  1. Click Triggers under MongoDB Cluster in the left navigation menu.
  2. Select Scheduled Triggers from the Trigger type dropdown menu.
  3. Click Add a Trigger to open the Trigger configuration page.
  4. 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.
  5. Click Save.
Creating a Trigger in the Realm UI.

Scheduled Triggers have the following configuration parameters:

Field
Description
Trigger Type
type: <string>

Required. The type of the Trigger.

For scheduled Triggers, this value should be set to SCHEDULED.

Trigger Name
name: <string>
Required. The name of the Trigger.
Linked Function
function_name: <string>

Required. The name of the Realm Function that the Trigger executes whenever it fires.

Info With Circle IconCreated with Sketch.Note

A scheduled Trigger does not pass any arguments to its linked Function.

Schedule
config.schedule: <string>
Required. The CRON expression that MongoDB Realm uses to determine when to fire the Trigger.
Give Feedback