So I have a collection of documents in cloud firestore where each document has this structure:
{
key1: value1
key2: value2
access: [{key: {key: value, key: value}, users: [...keys]},]
}
From a widget I want to get the documents where the id that I have exists in the users array. My query is this: labs.where('access.users', arrayContains: user.id).get()
I have read that in order to query nested elements you need dot notation. My problem is that it results in an error -> Bad state: No element. Which I assume is, because firestore doesn't know which access.users to query on since it is a list, but on the other hand I imagine that it should take each map one by one.
Maybe I'm missing something in my logic. Help is appreciated.