如何使用ID列表从集合中查询文档?假设我有以下几点:
List<String> someList = ['abc123', 'def456', 'hij789']; // Need to query for these documentIDs
我通常会执行以下操作。但这显然不起作用,因为我需要查询documentID。
Query query = Firestore.instance
.collection(APIPath.products())
.where('someField', whereIn: someList);
Query query = Firestore.instance
.collection(APIPath.products())
.where(FieldPath.documentId(), whereIn: someList);
请注意,您只能在列表中选择10个项目,这实际上可能比仅使用单独请求每个文档要慢get()
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句