Let's say I have a collection "books" with a ridiculously big amount of children in it.
(Please this example is fictionary so don't focus on the best solution for the books)
Now, I know we could/should build the collection in such a way that each user has his/hers own collection as in:
- books
- userId1
- book1
- book2
- book5
- userId5
- book2
- userId1
But I wonder if having the collection like below, whit "rules" that allow users to read only the children where the ID of the user is listed under the "reader" property.
- books
- book1
- reader
- userId1
- userId2
- userId4
- reader
- book2
- reader
- userId1
- reader
- book5
- reader
- userId3
- reader
- book1
If this rule is possible, could we call the reference mDatabase.child("books") and receive only a snap of the books the user can read instead of ALL books?