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

Are Firestore aggregation queries supported? (count, sum etc) #1955

Closed
giorgio79 opened this issue Jan 9, 2024 · 5 comments
Closed

Are Firestore aggregation queries supported? (count, sum etc) #1955

giorgio79 opened this issue Jan 9, 2024 · 5 comments
Labels
samples Issues that are directly related to samples.

Comments

@giorgio79
Copy link

Are aggregation queries supported? :) ChatGPT said this php library does not :P

https://firebase.google.com/docs/firestore/query-data/aggregation-queries#dart

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 9, 2024
@giorgio79 giorgio79 changed the title Are aggregation queries supported? (count, sum etc) Are Firestore aggregation queries supported? (count, sum etc) Jan 9, 2024
@shivgautam
Copy link
Contributor

It is available and was released on Dec 1. googleapis/google-cloud-php#6786

@giorgio79
Copy link
Author

Much appreciated! Could we get some php samples pls here? https://firebase.google.com/docs/firestore/query-data/aggregation-queries

@shivgautam
Copy link
Contributor

Yes. We are discussing it internally. Will be working on it. Can't provide an ETA at the moment though.

@giorgio79
Copy link
Author

Found a sample in the comment here https://github.com/googleapis/google-cloud-php/blob/main/Firestore/src/AggregateQuery.php but I am getting 0 in my own tests. Will wait for sg official on that page :P

` * Example:

  • use Google\Cloud\Firestore\FirestoreClient;
  • $firestore = new FirestoreClient();
  • $collection = $firestore->collection('users');
  • $query = $collection->where('age', '>', 18)->count();`

@shivgautam
Copy link
Contributor

Here are a few examples to get you started in the meantime:
https://github.com/googleapis/google-cloud-php/blob/main/Firestore/src/Aggregate.php#L66-L116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

No branches or pull requests

2 participants