Skip to content

count

To count documents in a collection or a query, use the count method. It’s available on Collection and query.

await db.posts.count();
//=> 420

The method returns Promise<number>.