I’ve got a tasks collectionwith Schema:
{
"title": "Task",
"properties": {
"_id": {
"bsonType": "objectId"
},
"label": {
"bsonType": "string"
},
"taskSet_id": {
"bsonType": "objectId"
},
}
and a TaskSet collection with schema:
{
"title": "TaskSet",
"properties": {
"_id": {
"bsonType": "objectId"
},
"owner_id": {
"bsonType": "objectId"
},
"editor_ids": {
"bsonType": "array",
"items": {
"bsonType": "objectId"
}
},
"viewer_ids": {
"bsonType": "array",
"items": {
"bsonType": "objectId"
}
}
}
}
I then have a relationship:
{
"taskSet_id": {
"ref": "#/relationship/mongodb-atlas/ungant/TaskSet",
"foreignKey": "_id",
"isList": false
}
}
I want to create an access Rule on Task with an Apply When:
{"taskSet_id.owner_id": "%%user.id"}
From the docs it says “App Services automatically replaces source values with the referenced objects or a null value in resolved GraphQL types and SDK models”, but my Rule does not appear to be working, and I get no results from JavaScript code when running collection.find({}).
I am admittedly confused by the whole Relationships topic, and how it relates to $lookup. I thought with the Relationship defined I might get the related document properties in results from a find(), but I do not. Can the Relationship be used for Rules permissions, and where else does it apply?