What you're trying to do is known as a collection group query, which is currently not possible on Cloud Firestore. See Firestore query subcollections
So with your current model you can efficiently look up the users of a board, but you cannot efficiently look up the boards for a user. To allow the latter, consider adding a collection of boards for each user in a structure like /users/$uid/boards/$boardid
.
Alternatively you can add an array field users
to the board document and use an array-contains
to perform the query:
db.collection('boards').where('users', 'array-contains', uid)