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

Support for Retrieving Total Document Count in a Collection #69

Open
vidus6com opened this issue Jan 16, 2025 · 0 comments
Open

Support for Retrieving Total Document Count in a Collection #69

vidus6com opened this issue Jan 16, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vidus6com
Copy link

Is your feature request related to a problem? Please describe.
We couldn't find a way to retrieve the total number of documents in a collection without querying and fetching all document data. This makes it challenging to efficiently display document counts, such as the total number of users in an admin panel etc., without performing unnecessary reads.

Describe the solution you'd like
If there is already a way to retrieve the total number of documents in a collection without fetching the document content, we would appreciate guidance. Otherwise, a dedicated method or API for this purpose would be highly beneficial. For example:

const docCount = await collection.getCount();

Describe alternatives you've considered

  • Querying all documents in the collection and counting them locally. However, this approach is resource-intensive and inefficient for large collections.

  • Manually tracking document counts, but this adds complexity and increases the likelihood of discrepancies during frequent updates.

Additional context
This feature would be particularly useful in scenarios like admin dashboards or analytics pages, where document counts need to be displayed quickly and efficiently.

@vidus6com vidus6com added the enhancement New feature or request label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants