How to Count Documents in a Convex Table?
I looked through the Convex documentation for instructions on how to get the document count of a table, but couldn't find any relevant information.
3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Is this relevant? https://www.convex.dev/components/aggregate
Use aggregate component with triggers. On insert, delete or update you should update the aggregate. Make sure you are using mutationWithTrigger for all of the operations.
Once the setup is finished, you can create a query for getting total count from aggregate.