Skip to content

[FR] Add SUM Functionality to AggregateQuerySnapshot #1703

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

Open
KKimj opened this issue Mar 31, 2025 · 2 comments
Open

[FR] Add SUM Functionality to AggregateQuerySnapshot #1703

KKimj opened this issue Mar 31, 2025 · 2 comments
Assignees
Labels

Comments

@KKimj
Copy link

KKimj commented Mar 31, 2025

Feature proposal

Firebase Component: Firestore

Hello,
The Firestore C++ SDK currently supports only the count() method in the firebase::firestore::AggregateQuerySnapshot class but lacks a sum() method (and avg()), which is essential for aggregating numeric fields across documents.

Current State

The public functions of AggregateQuerySnapshot are:

  • count()
  • is_valid()
  • Assignment operators (operator=)
  • query()

Reference:

Flutter SDK Implications

This enhancement would also benefit the Flutter SDK, which relies on the Firestore C++ SDK for Windows platform support. For example, in the FlutterFire plugin, unsupported aggregation types like sum currently result in:

...
      case AggregateType::sum:
        std::cout << "Sum is not supported on C++" << std::endl;
        break;
...

Adding sum() to the C++ SDK would also benefit Flutter developers using Firestore on Windows.

Benefits

Implementing a sum() method would:

  1. Provide access to Firestore's aggregation capabilities in the C++ SDK.
  2. Support more use cases for C++ and Flutter developers.

Looking forward to hearing thoughts and feedback!
Thanks,

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@cherylEnkidu
Copy link
Contributor

Hi @KKimj , thank you for filling out the ticket. This has been added to the feature request list.

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

No branches or pull requests

3 participants