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

[FEATURE REQUEST] Query subcollection using structuredQuery #439

Closed
ivanfemia opened this issue Oct 6, 2024 · 1 comment
Closed

[FEATURE REQUEST] Query subcollection using structuredQuery #439

ivanfemia opened this issue Oct 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ivanfemia
Copy link

Is your feature request related to a problem? Please describe.
I have a database structured as

collection1
|_document1
|_collection2
|_document2
|_fields

I want to query all documents in the collection2 that respond to a certain criteria.
Query method uses a url that can't be adjusted to this scenario as the actual URL should be projects/[PROJECT_ID]/databases/(default)/documents/collection1/document1:runQuery in stead of projects/[PROJECT_ID]/databases/(default)/documents/:runQuery

Describe the solution you'd like

  • Add a parameter in the FirestoreQuery class to customize subpath var sub_collection_path: String = ""
  • Change url path to include the subpath if set. var url: String = _base_url + _extended_url + query.sub_collection_path + _query_suffix

Describe alternatives you've considered
Tried different REST combination, but subcollection are not allowed in the where condition. In general '/' is not allowed

Additional context
This has been implemented and test with success in my project

@ivanfemia ivanfemia added the enhancement New feature or request label Oct 6, 2024
@WolfgangSenff
Copy link
Collaborator

Hm. It used to be able to handle sub collections. I'm surprised it doesn't anymore. That said, if you have a fix, feel free to fork it and open a PR so I can take a look, happy to accept it.

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

No branches or pull requests

2 participants