'StitchServiceError {message: "insert not permitted"} mongodb

I'm using mongodb stitch for backend with

Users can read all data, but only write their own data

template. Logging in with email/password is working. However when I tried to insert data, I'm getting this error:

StitchServiceError {message: "insert not permitted", name: "StitchServiceError", errorCode: 12, errorCodeName: "ArgumentsNotAllowed", stack: "StitchServiceError: insert not permitted↵    at St…tp://localhost:3000/static/js/0.chunk.js:18077:14"}
message: "insert not permitted"
name: "StitchServiceError"
errorCode: 12
errorCodeName: "ArgumentsNotAllowed"}

What is causing this error?



Solution 1:[1]

In my case, I was receiving the error while trying to do an insert from within a Realm function. The function was being executed from the realm sdk.

I was able to fix this issue by adding/specifying the field name in the read/write rules within the specific realm app (auth is required)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 oblivion02