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
Describe the bug
As requested by KyleTheCoder an issue about the unexpected but working method.
I had a few top-level collections before, but I changed to a subcollection structure so I have {collection/document/subcollection/documents} structure.
Now when it comes to queries you would expect that you would have to feed the path into it to get to the subcollection but this doesn't work. Every subcollection with the same name seems to be joined in the backend and treated as a top-level connection which means you have to query the subcollection directly and not include any path.
To Reproduce
Add subcollection
To create a subcollection dynamically create a new document but instead of referencing a single collection as the collection reference feed in a path to the subcollection. as an example: {main-collection/document_id/sub-collection}
Update:
I'm also building another app with Firebase using Flutter and Dart and in that implementation, you do need to specify the subcollection as {main-collection.document_id.sub-collection} but you can also do a compound query which is then called as {sub-collection} which combines all collection with that id. Potentially this is done by default via the Rest api?
Okay, looking at your code, I actually think it's doing it correctly. It looks like your latter guess must be correct: it is taking the main collection ID and using it as the parent to which all subcollections are inspected with the query. I'm going to leave this open for more discussion and for anyone else to chime in, but if I'm reading the Firebase website correctly, that's how it should work for the REST API, at least.
I'm reworking the Firestore part of the plugin and as it turns out, there's a new (or perhaps old and I missed it) way to create collections and subcollections via the REST API. I will implement it and close this when I get to it, just updating to let you know!
Describe the bug
As requested by KyleTheCoder an issue about the unexpected but working method.
I had a few top-level collections before, but I changed to a subcollection structure so I have {collection/document/subcollection/documents} structure.
Now when it comes to queries you would expect that you would have to feed the path into it to get to the subcollection but this doesn't work. Every subcollection with the same name seems to be joined in the backend and treated as a top-level connection which means you have to query the subcollection directly and not include any path.
To Reproduce
Add subcollection
To create a subcollection dynamically create a new document but instead of referencing a single collection as the collection reference feed in a path to the subcollection. as an example: {main-collection/document_id/sub-collection}
Query this collection by issuing a query as if it were a top-level collection, doing a path to the collection throws an error
Expected behavior
I would have expected it to need a path to the collection
Environment:
-Windows11
The text was updated successfully, but these errors were encountered: