Navigation

Configure Service Rules

In order to call a service action, you must first define a service rule that enables and configures the capabilities of the action. You can define service rules from the Realm UI or by importing a service configuration directory that contains a rule configuration file. Select the tab below that corresponds to the method you want to use.

1

You can create and configure a service rule from its associated service page in the Realm UI.

To define a new service rule:

  1. Click Services in the left navigation menu.
  2. Click on the service that you want to specify a rule for.
  3. Click on the Rules tab of the service.
  4. Click New Rule.
  5. Specify a name for the rule in the textbox that appears.
  6. Click Add Rule to confirm the creation of the new rule.
2

To configure the new service rule you just created:

  1. Click on the newly created rule in the rules list on the left-hand side of the page.
  2. In the list of Actions, select all of the actions that you want the rule to apply to.
  3. For the When box, specify a JSON expression that will evaluate to true when you want the action to be permitted.

    Info With Circle IconCreated with Sketch.Note

    If you specify {}, the expression will always evaluate to true and MongoDB Realm will always allow the associated actions to be called.

3

Once you've finished configuring the rule, click Save. Once saved, the rule takes effect immediately.

Give Feedback