- Stitch >
- MongoDB Atlas >
- Configure MongoDB
Configure Advanced Rules¶
On this page
Overview¶
You can manually configure all aspects of a collection’s rules by editing the underlying configuration document directly through the Stitch UI. Editing rules in this way is referred to as Advanced Mode.
When To Use Advanced Mode¶
The default or “Basic Mode” rules editor in the Stitch 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:
- Configure a role that can only insert documents.
- Define field-level read or write permissions for a field in an embedded document.
- Determine field-level write permissions dynamically using a JSON expression.
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.
Procedure¶
Convert to Advanced Mode¶
Click Advanced Mode in the top right corner of the collection rules interface. The UI will switch an editor that shows a preview of the underlying Advanced Mode rule configuration document. Click Convert to Advanced Mode and then click Convert Rules to confirm.

Define the Collection Rules¶
Once you have converted the collection to Advanced Mode you can edit the underlying configuration document. Collection rule configuration documents have the following form:
Field | Description |
---|---|
roles |
An array of Query Role configuration documents that each define a single role’s Apply When condition and associated CRUD permissions. Important Stitch 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 Query Filter configuration documents that each define a filter on the collection. |
schema |
A Document 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 |
Save the Updated Collection Rules¶
Once you have finished editing the collection rules, click Save. Stitch will immediately begin using the new rule configuration you defined for all incoming queries on the collection.