Lets get started with bit of a context.
And it is working fine as expected. I can access those _user data whose who is currently logged in.
Lets gets to an actual Issue
I have two collection.
‘_articles’ and ‘_user_articles’ .
‘_articles’ contains the global data, like ’ title, description, content .
‘_user_articles’ holds user interaction on above _article, such as ’ likes, votes , notes etc’
_user_articles is set up as :
_user_articles : {
objectID:,
createdby: user_id,
_article. : '_articles ' ( the global one )' (on atlas the object id of that _article is stored)
_vote : ,
flag: boolean ,
}
The document rule for _user_articles is as :
"document_filters": {
"write": {
"createdby": "%%user.id"
},
"read": {
"createdby": "%%user.id"
}
}
such that the user who created the _user_article can only access that _user_Article.
For now I am maintaining '_user_list field for ‘_articles’ and defining the sync rules such that if _user_list on ‘_Articles’ contains logged in user id, then that _articles gets accessible on local.
I dont know if this is the correct practice.
Another thing
The _user_article has flag value boolean, and _article filed which holds’_articles’ . If the 'flag field is true in ‘_user_article’ I want '_article ’ of same ‘_article’ to be accessible locally. Is there any better way to achieve this?