Is it Possible to Retrieve Subcollections in Cloud Firestore? #AskFirebase
Why Stack Overflow recommends it
Stack Overflow users link it when explaining Firestore's limits on querying subcollections and for the workaround of storing a map of ids in a document.
Recommended by 2 people across 2 different months, 2018 to 2018.
What it is
A short #AskFirebase episode where Firebase engineers Jen and Todd Kerpelman answer user questions about Cloud Firestore, including paginating by page number and whether subcollections can be retrieved or queried across documents. It is an official Q&A video from the Firebase channel.
What people said
Recommends Odai A. Ali · 2018-01 · Stack Overflow · on “get all data (documents) inside subcollection of main collection firestore”
That kind of subcollection query is not supported by firestore currently here is a link to an episode of #askFirebase that explain how to deal with such scienario [this video]
Recommends Dharan · 2018-04 · Stack Overflow · on “Angular2 Firestore: How to search in array”
change your structure like this export interface Account { uid { uid: string; title: string; startDate: Date; endDate: Date; manager: User; members: User[]; } } export interface User { uid { uid: string; email: string; displayName: string; isActive: boolean; } } in your service .where('uid.members', '==', user) for reference watch this video till the end [this video]
Cites Alex Mamo · 2018-01 · Stack Overflow · on “How to query a Collection after a specific Document in Cloud Firestore with Android?”
There actually a trick that can be done. Instead of duplicating data, you can add in your docKey1 document a map , as Todd Kerpelman said here [this video] . Your document whould look like this: userLists (collection) | --- docKey1 (document) | --- listName: "ListOne" | --- date: January 15, 2018 at 9:56:24 AM UTC+2 | --- users | --- userId1: true | --- userId2: true So you can query that particular document to get all the user ids. So in this way you can get a sort what you are asking for.
Cites Josh Pittman · 2018-04 · Stack Overflow · on “Can I query firestore with a wildcard as admin in a cloud function?”
Ok, thanks. I just saw a video that says you might be supporting the ability to search across subcollections [this video] so I was wondering if there was any progress on that. Shame it's not in the works.
Cites Jorge Montalvão · 2018-08 · Stack Overflow · on “Cloud Firestore multiple documents and unknown collection path”
O found 2 options: 1. As @todd-kerpelman suggested in this video I can use something like `.whereField("userList.uid").isGreaterThan(nil)` 2. As Jeff (from Angular Firebase) in this video I can use `.where("userList","array-contains","uid")` based on JavaScript SDK Release Notes Version 5.3.0 - July 19, 2018