Skip to content

feat(firestore): add accumulators expressions#9576

Merged
yvonnep165 merged 7 commits intomainfrom
shiqingp/accumulators-expressions
Feb 23, 2026
Merged

feat(firestore): add accumulators expressions#9576
yvonnep165 merged 7 commits intomainfrom
shiqingp/accumulators-expressions

Conversation

@yvonnep165
Copy link
Contributor

Add new accumulators expressions first, last, array_agg, array_agg_distinct and integration tests for the four expressions

@yvonnep165 yvonnep165 requested review from a team as code owners February 19, 2026 15:49
@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: e146415

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
firebase Minor
@firebase/firestore Minor
@firebase/firestore-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yvonnep165, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances Firestore's aggregation capabilities by introducing several new accumulator expressions. These additions provide developers with more powerful tools to perform complex data manipulations, such as retrieving specific elements from ordered sets or collecting values into arrays, directly within their database queries. The changes are fully documented and thoroughly tested to ensure reliability and ease of use.

Highlights

  • New Accumulator Expressions: Added support for four new accumulator expressions: first, last, array_agg, and array_agg_distinct.
  • API Definitions: Introduced new API definitions for these expressions in both Firestore and Firestore Lite pipelines.
  • Documentation Updates: Updated developer documentation to include detailed descriptions and examples for each new accumulator expression.
  • Comprehensive Testing: Included integration and unit tests to ensure the correct functionality of the new accumulator expressions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .changeset/few-dodos-ring.md
    • Added a new changeset entry to document the introduction of first, last, array_agg, and array_agg_distinct expressions.
  • common/api-review/firestore-lite-pipelines.api.md
    • Added new arrayAgg, arrayAggDistinct, first, and last functions.
    • Added arrayAgg, arrayAggDistinct, first, and last methods to the Expression class.
  • common/api-review/firestore-pipelines.api.md
    • Added new arrayAgg, arrayAggDistinct, first, and last functions.
    • Added arrayAgg, arrayAggDistinct, first, and last methods to the Expression class.
  • docs-devsite/firestore_lite_pipelines.expression.md
    • Updated the Expression class documentation to include arrayAgg, arrayAggDistinct, first, and last methods with examples.
  • docs-devsite/firestore_lite_pipelines.md
    • Updated the global functions documentation to include arrayAgg, arrayAggDistinct, first, and last with examples.
  • docs-devsite/firestore_pipelines.expression.md
    • Updated the Expression class documentation to include arrayAgg, arrayAggDistinct, first, and last methods with examples.
  • docs-devsite/firestore_pipelines.md
    • Updated the global functions documentation to include arrayAgg, arrayAggDistinct, first, and last with examples.
  • packages/firestore/lite/pipelines/pipelines.ts
    • Exported the new first, last, arrayAgg, and arrayAggDistinct functions.
  • packages/firestore/src/api_pipelines.ts
    • Exported the new first, last, arrayAgg, and arrayAggDistinct functions.
  • packages/firestore/src/lite-api/expressions.ts
    • Implemented first, last, arrayAgg, and arrayAggDistinct methods for the Expression class.
    • Added corresponding global functions for first, last, arrayAgg, and arrayAggDistinct.
  • packages/firestore/test/integration/api/pipeline.test.ts
    • Added integration tests for first, last, arrayAgg, and arrayAggDistinct accumulators.
  • packages/firestore/test/lite/pipeline.test.ts
    • Added unit tests for first, last, arrayAgg, and arrayAggDistinct accumulators.
Activity
  • The pull request introduces new features and documentation, indicating active development.
  • No specific comments or reviews have been recorded in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces four new accumulator expressions: first, last, arrayAgg, and arrayAggDistinct. These are implemented as methods on the Expression class and as top-level functions, following the existing patterns in the SDK. Integration tests for both the standard and lite versions of the SDK are included, covering various scenarios and ensuring correctness. Documentation and API reports are also updated accordingly. The implementation is solid and follows established conventions.

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

Successfully merging this pull request may close these issues.

4 participants