Docs Menu

Docs HomeAtlas App Services

Configure Advanced Rules

On this page

  • Overview
  • When To Use Advanced Mode
  • Procedure
  • Navigate to the Collection Rules Screen
  • Convert to Advanced Mode
  • Define the Collection Rules
  • Save the Updated Collection Rules

You can manually configure all aspects of a collection's rules by editing the underlying configuration document directly through the App Services UI. Advanced Mode refers to editing rules in this manner.

The default or "Basic Mode" rules editor in the App Services UI covers the majority of use cases for collection rules. However, there are times when you need more fine-grained control than the UI interface provides. Consider using Advanced Mode if you need to do the following:

Warning

Once you convert a collection's rules to Advanced Mode, you may not be able to switch back to editing that collection's rules through the Basic Mode interface.

1

You can edit collection rules in Advanced Mode from the MongoDB rules screen in the App Services UI. To get to the rules screen for a collection, click Rules beneath Data Access in the left navigation menu and then select the collection from the list.

Basic mode rules editor in the App Services UI
2

Click the </> symbol by VIEW in the top left corner of the collection rules interface to enter Advanced View. The UI will switch an editor that shows a preview of the underlying Advanced Mode rule configuration document. Click Convert to Advanced Mode. Type "convert" and then click Confirm to confirm your action.

Advanced Mode preview in the App Services UI collection rules editor.
3

Once you have converted the collection to Advanced Mode you can edit the underlying configuration document. Collection rule configuration documents have the following form:

{
"roles": [
<Role Configuration>,
...
],
"filters": [
<Filter Configuration>,
...
],
"schema": {
"properties": {
"<Field Name>": <Schema Document>,
...
}
}
}
Field
Description
roles

An array of Role configuration documents that each define a single role's Apply When condition and associated CRUD permissions.

Important

App Services evaluates roles for each query in the order that they're defined. Ensure that each role configuration document's array index matches its desired position in the evaluation order.

filters
An array of Filter configuration documents that each define a filter on the collection.
schema

A schema that configures the shape and contents of all documents in the collection.

Note

The root of all collection schemas must be an object schema document. You can embed other schema types inside the properties field of the root schema.

For an example of how to define relationships in advanced mode, see: Configure Relationships.

4

Once you have finished editing the collection rules, click Save Draft in the top right corner. App Services will immediately begin using the new rule configuration you defined for all incoming queries on the collection.

←  Device Sync-Compatible PermissionsData Access Role Examples →