Skip to content

Support for Retrieving Total Document Count in a Collection #69

@vidus6com

Description

@vidus6com

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions