I have a collection. Each document has object readers that will store the uid of the people who will have access to the documents. This can be one or more users who can access the document. 
I am using angular firebase
constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore) { this.afAuth.authState.subscribe(auth => { this.users = afs.collection<User>('users', ref => ref.where('readers.' + auth.uid, '==', true)).valueChanges(); }); }
If I use a rule that allows everything to be read, the correct entries will be displayed on my page
match /users/{userId=**} { allow read, write; }
If I add a rule for filtering using uid, I get the Missing or insufficient permissions error.
match /users/{userId=**} { allow read, write: if resource.data.readers[request.auth.uid] == true || resource.readers[request.auth.uid] == true; }
Appreciate any help regarding what I did wrong for the rules. Thanks in advance.
source share