Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for collection_group query #17

Open
juviwhale opened this issue Nov 12, 2019 · 1 comment
Open

Add support for collection_group query #17

juviwhale opened this issue Nov 12, 2019 · 1 comment

Comments

@juviwhale
Copy link

Add support for the new collection_group query that was recently added.

# Example Data
parent_1 = db.collection(u'parents').document(u'molly_smith').set({
        u'name': u'Molly Smith',
        u'age': 49
})
child_1a = db.collection(u'parents').document(u'u'molly_smith').collection(u'children').document().set({
        u'name': u'Tom Smith JR',
        u'age': 17
})
parent_2 = db.collection(u'parents').document(bill_jones').set({
        u'name': u'Bill Jones',
        u'age': 56
})
child_2a = db.collection(u'parents').document(u'bill_jones').collection(u'children').document().set({
        u'name': u'Jerry Jones',
        u'age': 17
})

# Collection Group Query
children = db.collection_group(u'children').where(u'age', u'==',17')
docs = children.stream()
for doc in docs:
    print(u'{} => {}'.format(doc.id, doc.to_dict()))

Documentation of Query

GoogleCloudPlatform Example Snippet

@flrngel
Copy link

flrngel commented Nov 21, 2022

For those who are looking for collection_group, check this repository: https://github.com/ainbr/python-mock-firestore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants