Reputation: 59
I am using python's firebase-admin. I want to fetch the subcollection (and its documents) but the problem is the parent documents of the subcollection do not exist. Even though the subcollections of the non existent documents are still accessible.
Here is the screenshot of the cloud firestore
Here is the code I tried but it prints nothing:
db = firestore.client(app)
message_docs = db.collection('message').get()
for doc in message_docs:
print(doc.id)
Is it possible to fetch subcollections using python in this scenario? I don't know the ID of the documents.
Upvotes: 1
Views: 587
Reputation: 317467
Without a document ID, it's not possible. If you want all of the documents from all of the subcollections of all of the documents in "message" (both missing and present), then you can use a collection group query. Without a document ID, you can't construct a query for a specific subcollection.
Upvotes: 2