Skip to content Skip to sidebar Skip to footer

Firestore: List Subcollections Of A Document Using Python

Is it possible list subcollections of a document using python? It seems that google documentation is discordant Here they say that get collections method is not available in the Py

Solution 1:

You're right. This is missing from the documentation:

collnameref = db.collection(collname)
docs = collnameref.stream()
for doc in docs:
    # List subcollections in each doc
    for collection_ref in doc.reference.collections():
        print(collection_ref.parent.path + collection_ref.id)

Post a Comment for "Firestore: List Subcollections Of A Document Using Python"