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

feat: add support for recursive queries #407

Merged
merged 15 commits into from Aug 11, 2021
Merged

feat: add support for recursive queries #407

merged 15 commits into from Aug 11, 2021

Conversation

craiglabenz
Copy link
Contributor

Adds the ability for queries to begin fetching all nested documents regardless of their collection name. Previously, the only similar mechanic available was the all_descendants parameter (available via the collection_group class), which is imperfectly named and in fact only fetches all descendants with the same parent name. So, for example:

/users/alfred
/users/alfred/pets/scruffy
/users/alfred/users/alfreds-butler

In this case, running db.collection_group('users').get() would fetch /users/alfred and /users/alfred/users/alfreds-butler, but NOT /users/alfred/pets/scruffy.

Not that this is decidedly not all of Alfred's descendants.


And thus: Recursive Queries ™️. Starting now, to fetch all three documents from the above hypothetical, a developer would run one of these two options:

db.collection_group('users').recursive().get()
# or this similar statement with an identical outcome:
db.collections('users').recursive().get()

@craiglabenz craiglabenz requested a review from a team July 29, 2021 21:17
@craiglabenz craiglabenz requested a review from a team as a code owner July 29, 2021 21:17
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Jul 29, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 29, 2021
@dandhlee dandhlee added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 30, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 30, 2021
@tseaver tseaver changed the title feat: added recursive query feat: add support for recursive queries Aug 9, 2021
google/cloud/firestore_v1/_helpers.py Outdated Show resolved Hide resolved
google/cloud/firestore_v1/base_collection.py Outdated Show resolved Hide resolved
@craiglabenz craiglabenz added the automerge Merge the pull request once unit tests and other checks pass. label Aug 10, 2021
@craiglabenz craiglabenz merged commit eb45a36 into master Aug 11, 2021
@craiglabenz craiglabenz deleted the recursive-query branch August 11, 2021 13:02
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants