collectionGroup within a certain path

后端 未结 2 1164
攒了一身酷
攒了一身酷 2021-01-21 00:50

I\'d like to do a collection group query but within a certain path, meaning that I would like to target collections not only with the collectionId but also with where the collec

2条回答
  •  花落未央
    2021-01-21 01:09

    This is currently not possible with Cloud Firestore. When you perform a collection group query, it will use all of the collections and subcollections with the given name. You are not able to narrow to scope of the query to specific collections.

    What you can do instead is store a field inside the documents in each subcollection that identify which top-level collection they belong to, then use that field to filter your results.

提交回复
热议问题