-
Type:
Task
-
Resolution: Cannot Reproduce
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
Expected results
Trying to insert into a collection that does not support pk alterations should not fail using Rules.
Actual Results
Since sync client tries to always set pk field _id, if the schema does not support alternation of the pk, the insertion will fail.
Eg this schema does not allow _id alternations, thus insertion will always fail (since we are setting _id in the sync client):
{
"collection": "momentInteractions",
"database": "db",
"roles": [
{
"name": "creator",
"apply_when": {},
"fields": {
"_id": {
"write": false
},
"viewer": {
"write": true
},
"isPermitted": {
"write": true
}
},
"read": true,
"insert": true,
"delete": false,
"search": false}]
}
Steps & Code to Reproduce
- Using Rules, set up a schema in mongo db atlas that does not support alternation to primary keys.
- Try to insert into the collection.
- Insertion will fail, reporting that the constraint around the PK has not been respected.