This endpoint allows you to retrieve the total number of documents in a collection. It supports query parameters for filtering, enabling you to count documents based on specific criteria.
GET /users/count
// result
// {
// total: 2
// }
For example, this endpoint returns the total number of users in the collection.The `q` query parameter allows you to filter documents before counting them. For example, to count users with the name "mike":
GET /users/count?q[name]="mike"
To count users with the name "mike" or "john":
GET /users/count?q[name]="mike"&q[name]="john"
To count users whose names contain "m", use the `$regex` operator:
GET /users/count?q[name][$regex]=m
Regex queries are case-sensitive by default. To perform a case-insensitive search, add &q[name][$options]=iYou can combine multiple query parameters to refine the count results.