I have a collection "data" with roles for different permission levels like Read and Update. User can only update their own documents and read some. But everybody can insert new documents. I defined the roles and created an function to check the users permissions. BUT no one is permitted to insert new documents.
This is my role definition:
{
"%%true": {
"%function": {
"name": "checkAccess",
"arguments": [
"%%root",
"Read"
]
}
}
}
My function checkAccess returns true when one condition is true. But if there is a new document non of the conditions deliver true.
So I tried to define a role definition like:
{
"%%prevRoot": {
"%exists":true
}
}
And grant InsertDocument permissions to make shure that everybody can insert new documents. But %%prevRoot can´t resolved (ErrMsg: do not know how to expand '%%prevRoot')
It´s hard to become familiar with mongodb Stitch without good sources. Hopefully you can help me with this.