如果有这样的收藏
Shop(Collection):
-shopId(Document)
-name
-adresse
-itemSold (Nested Collection)
-itemId
-....
-....
我该如何在flutter中编写查询,该查询将仅向我返回itemSold集合中具有特定itemId的商店。
它会花费很多阅读时间吗?
您如何处理这种类型的树,我在noSQL数据库中还很新。我习惯于传统数据库。
您可以使用.where方法。
在您的情况下,如下所示:
DocumentReference shopInstance = Firestore.instance
.collection('shops')
.document('shopsID'):
await shopInstance
.collection('itemSold')
.where('itemID', isEqualTo: 'someId')
.getDocuments()
.then()...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句