Error messages in the MongoDB Realm UI or logs related to operations such as inserts and updates not being permitted are usually caused by incorrectly configured Realm Rules. To resolve this issue, follow these steps:
1. Navigate to the Rules page in your Realm App and ensure that you have configured and saved the rules for accessing the desired Atlas collection. Without completing this step, your clients in Realm are not authorized to access that particular Atlas collection.
This example demonstrates where all Realm clients in this Realm App have read privileges of all fields in the blog.comment
collection:
2. On the Rules page, review the configuration of Permissions, Schema, and Filters. If you make any changes to your Realm App, remember to click Review & Deploy in the blue banner at the top of the Realm UI to deploy the changes. See Deploy from the Realm UI and Why are the user modifications made to the Realm UI not reflected in the Realm Application?
3 If you are using Realm Functions:
Click Functions in the left panel and navigate to the function you want to test.
Click Console at the bottom, and fill in the parameters for calling the function. The user for testing by default is System User
Click Run
If you still receive an error message, review the corresponding function code.
4. If the function executes successfully in the previous step, run the function again with a different user. This is necessary because Realm uses the System user by default when a user is not selected. This user has advanced privileges and automatically bypasses all rules.
Click Change User next to the Run button and select the Realm user you want to test with.
Click Run.
If you encounter the operations not permitted
error in this step, confirm you have granted the appropriate permission to the selected Realm user on the Rules page, and ensure that the Realm user has all the necessary metadata if Realm user metadata is being used.
5. For further troubleshooting, review your Realm App logs for additional information. If you encounter this error in your application, review the console logs for your application as well.
For further help, contact MongoDB Support and provide us with your console output and error messages.