Configure Service Rules¶
Overview¶
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.
Procedure¶
Create a New Rule¶
You can create and configure a service rule from its associated service page in the Realm UI.
To define a new service rule:
- Click Services in the left navigation menu.
- Click on the service that you want to specify a rule for.
- Click on the Rules tab of the service.
- Click New Rule.
- Specify a name for the rule in the textbox that appears.
- Click Add Rule to confirm the creation of the new rule.
Configure the Rule¶
To configure the new service rule you just created:
- Click on the newly created rule in the rules list on the left-hand side of the page.
- In the list of Actions, select all of the actions that you want the rule to apply to.
For the When box, specify a JSON expression that will evaluate to
true
when you want the action to be permitted.NoteIf you specify
{}
, the expression will always evaluate totrue
and MongoDB Realm will always allow the associated actions to be called.

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