You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the Run Query we can query within collection group of a document's subcollections, but this is not available in the client SDK. The client SDK allows querying collection group only on the root level.
Steps to reproduce:
For example we have a collection of rootCollection and its documents have subcollection subCollection. Documents of subCollection also have subcollection subSubCollection. It's possible to query collection group subSubCollection across all database, but not just inside rootCollection/someDocId.
Relevant Code:
firebase.firestore().collectionGroup('subSubCollection');// OK// collectionGroup does not exist in DocumentReference. firebase.firestore().collection('rootCollection').doc('docId').collectionGroup('subSubCollection');// Error
Is there anything preventing from implementing this in the client SDK?
The text was updated successfully, but these errors were encountered:
Thanks for pointing out the inconsistencies between SDKs and the REST API.
First I want to confirm that it is possible to run collection group queries on sub-collections via REST API, it has a restriction though: there must not be any filters or order-by with the query.
Second, given the restriction above, we will not support this in SDKs, we will re-evaluate this when this restriction is lifted.
Third, there are some workarounds in SDKs that you can do to simulate a collection group query on sub-collections, unfortunately they require you to have some sort of special filed in your documents. For example, you can have a field for parent's collection path in a document, and filter on this field when running collection group queries.
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
With the Run Query we can query within collection group of a document's subcollections, but this is not available in the client SDK. The client SDK allows querying collection group only on the root level.
Steps to reproduce:
For example we have a collection of rootCollection and its documents have subcollection subCollection. Documents of subCollection also have subcollection subSubCollection. It's possible to query collection group subSubCollection across all database, but not just inside rootCollection/someDocId.
Relevant Code:
Is there anything preventing from implementing this in the client SDK?
The text was updated successfully, but these errors were encountered: