Firestore查询列表地图对象 [英] Firestore query List map object

查看:66
本文介绍了Firestore查询列表地图对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我查询集合中的地图对象列表吗?请在下面找到样本文件 从firestore中查看我的示例文档

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

在图像上方,我想获取基于personId的GROUP集合,基本上是List类型.

In above the image I want to fetch the GROUP collection based on personId which is basically List type.

搜索解决方案android.请指教

Searching for solution android. Please advise

推荐答案

不知道它是否是在Firestore中执行查询的最佳方法,但我才发现这种方法.您可以查询地图,但同时需要personId和personName

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();
 }

这篇关于Firestore查询列表地图对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆