criteria
, ] callback
)Returns the number of records in your database that meet the given search criteria.
# | Description | Accepted Data Types | Required ? |
---|---|---|---|
1 | Find Criteria | {} , string , int |
No |
2 | Callback | function |
No |
# | Description | Possible Data Types |
---|---|---|
1 | Error | Error |
2 | Number of Records | int |
User.count({name:'Flynn'}).exec(function countCB(error, found) {
console.log('There are ' + found + ' users called "Flynn"');
// There are 1 users called 'Flynn'
// Don't forget to handle your errors
});
Any string arguments passed must be the ID of the record.