0

我如何在一个流中找到我所有“商店”的所有“产品”(所以不仅仅是一个特定的商店)?

这是代码:

return StreamBuilder<QuerySnapshot>(
            stream: Firestore.instance.collection('users').document(uid).collection('stores')
                .document(storeID).collection('products').snapshots(),
            builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) { 
              ... 

非常感谢!

4

1 回答 1

2

如果您想获取名称为“products”的所有子集合中的所有文档,那么您将需要使用集合组查询

Firestore.instance.collectionGroup('products').snapshots()
于 2020-09-19T23:52:19.933 回答