Reputation: 11
Can someone help me to query the list of map object in the collection? Please find sample document below see my sample document from firestore
In above the image I want to fetch the GROUP collection based on personId which is basically List type.
Searching for solution android. Please advise
Upvotes: 1
Views: 817
Reputation: 11
Not sure whether its an optimal way of performing a query in Firestore but i only found this way. You can query a map but you will need both the personId as well as personName
Future<void> memberList() async {
List<Map> personList= new List<Map>();
Map<String, dynamic> personData = new Map<String,dynamic>();
personData ["personId"] = pid;
personData ['personName'] = pname;
personList.add(personData);
QuerySnapshot query;
query = await FirebaseFirestore.instance.collection('Group')
.where('groupMembers',arrayContainsAny: personList).get();
}
Upvotes: 1