I don't know if this is a bug with Firebase, or maybe it's stated in their documentation, I can't get the IDs from the collection where the document has No fields but Only Subcollection. Please assist me with this. I tried to put some field on some document, then it has shown, then I deleted it again still it shows and I confirmed it's not Cache by opening Incognito on Chrome and still the document was only one showing even though I deleted the field I was testing with. My collection structure looks as on the image attached What I am trying to get is the Ids inside invoices. My current code is I am using Javascript:-
async getMarker() {
const snapshot = await this.db.collection("customer_invoices").get()
return snapshot.docs.map((doc: any) => doc.id);
}
There is no way to query those parent documents, as they don't exist. The console only shows these placeholders so that you can navigate to the subcollections.
The only way I can think of to get these IDs is to do collection group query on all your invoices
subcollections, and then find the parent document of each invoice .
Also see:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.