Count Documents
count Method
The method used to count the number of documents in a collection. A find criteria can be used to count with a filter.
To count all records, use an empty criteria. Ie count()or count({})
Usage
const count = await User.count({});
// Do something with count.
const count = await User.count({ age: { $gt: 12 } });
// Do something with count.
Please refer to the find methods for the operators that can be implemented in the criteria.