Skip to content

feat(firestore): support queries in getCountFromServer#988

Open
robingenz wants to merge 2 commits into
mainfrom
feat/issue-984-firestore-count-query
Open

feat(firestore): support queries in getCountFromServer#988
robingenz wants to merge 2 commits into
mainfrom
feat/issue-984-firestore-count-query

Conversation

@robingenz
Copy link
Copy Markdown
Member

Summary

  • Adds optional compositeFilter and queryConstraints to GetCountFromServerOptions so callers can count documents in a filtered/limited query, not only entire collections.
  • Wires the new options through the Web, iOS, and Android implementations using the same helpers getCollection already uses.

Closes #984

Test plan

  • Call getCountFromServer with only reference (existing behavior unchanged).
  • Call getCountFromServer with a compositeFilter (and/or) and verify the count matches a filtered getCollection.
  • Call getCountFromServer with queryConstraints (e.g. where, limit) and verify the count.
  • Verify on Web, iOS, and Android.

Copilot AI review requested due to automatic review settings May 25, 2026 08:29
@robingenz robingenz self-assigned this May 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Firestore plugin’s getCountFromServer API to support counting documents for queries (not just whole collections) by adding optional compositeFilter and queryConstraints, and wiring them through Web, iOS, and Android implementations using the same query-building patterns as getCollection.

Changes:

  • Add compositeFilter and queryConstraints to GetCountFromServerOptions (TypeScript definitions + README docs).
  • Web: reuse the existing buildCollectionQuery helper for getCountFromServer.
  • iOS/Android: apply composite filters and query constraints before executing the server aggregation count.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/firestore/src/web.ts Routes getCountFromServer through the shared query builder to support filters/constraints.
packages/firestore/src/definitions.ts Extends GetCountFromServerOptions with compositeFilter and queryConstraints.
packages/firestore/README.md Documents the newly supported options for getCountFromServer.
packages/firestore/ios/Plugin/FirebaseFirestorePlugin.swift Passes compositeFilter/queryConstraints from the Capacitor call into native options.
packages/firestore/ios/Plugin/FirebaseFirestore.swift Builds a Query with filters/constraints before count.getAggregation(source: .server).
packages/firestore/ios/Plugin/Classes/Options/GetCountFromServerOptions.swift Parses/holds the new query-related options.
packages/firestore/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/firestore/FirebaseFirestorePlugin.java Passes compositeFilter/queryConstraints into native options.
packages/firestore/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/firestore/FirebaseFirestore.java Builds a Query with filters/constraints before calling query.count().
packages/firestore/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/firestore/classes/options/GetCountFromServerOptions.java Parses/holds the new query-related options.
.changeset/firestore-count-from-server-query.md Declares a minor bump for the new capability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 25, 2026

Open in StackBlitz

@capacitor-firebase/analytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/analytics@988

@capacitor-firebase/app

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app@988

@capacitor-firebase/app-check

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app-check@988

@capacitor-firebase/authentication

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/authentication@988

@capacitor-firebase/crashlytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/crashlytics@988

@capacitor-firebase/firestore

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/firestore@988

@capacitor-firebase/functions

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/functions@988

@capacitor-firebase/messaging

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/messaging@988

@capacitor-firebase/performance

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/performance@988

@capacitor-firebase/remote-config

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/remote-config@988

@capacitor-firebase/storage

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/storage@988

commit: 511d02c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(firestore): support queries in getCountFromServer

2 participants