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

feat(firestore): add getCountFromServer(...) method #785

Closed
3 of 13 tasks
user08091989 opened this issue Dec 26, 2024 · 1 comment · Fixed by #792
Closed
3 of 13 tasks

feat(firestore): add getCountFromServer(...) method #785

user08091989 opened this issue Dec 26, 2024 · 1 comment · Fixed by #792
Assignees

Comments

@user08091989
Copy link

user08091989 commented Dec 26, 2024

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Functions
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Current problem

There is no way now to get a count of files matching a query using your plugin, which results in huge reads being necessary. It affects the cost and performance.

Preferred solution

Add a function equivalent to getCountFromServer

Alternative options

No response

Additional context

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

Before submitting

@robingenz robingenz changed the title feat: Add getCountFromServer option feat(firestore): add getCountFromServer(...) method Dec 27, 2024
@robingenz robingenz changed the title feat(firestore): add getCountFromServer(...) method feat(firestore): add getCount(...) method Dec 27, 2024
@robingenz robingenz changed the title feat(firestore): add getCount(...) method feat(firestore): add getCountFromServer(...) method Dec 27, 2024
@robingenz
Copy link
Member

@ebarooni Feel free to work on this in the new year.

I suggest the following types:

export interface FirebaseFirestorePlugin {
	getCountFromServer(options: GetCountFromServerOptions): Promise<GetCountFromServerResult>;
}

export interface GetCountFromServerOptions {
	reference: string;
}

export interface GetCountFromServerResult {
	count: number;
}

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

Successfully merging a pull request may close this issue.

3 participants