Edit Page 
    
    .count()
Get the total number of records matching the specified criteria.
var numRecords = await Model.count(criteria);
Usage
| # | 
Argument | 
Type | 
Details | 
| 1 | 
criteria | 
 | 
The Waterline criteria to use for matching records in the database.  Note that count queries do not support pagination using skip and limit or projections using select. | 
Result
| Type | 
Description | 
 | 
The number of records from your database that match the given criteria. | 
Errors
| Name | 
Type | 
When? | 
| UsageError | 
 | 
Thrown if something invalid was passed in. | 
| AdapterError | 
 | 
Thrown if something went wrong in the database adapter. | 
| Error | 
 | 
Thrown if anything else unexpected happens. | 
See Concepts > Models and ORM > Errors for examples of negotiating errors in Sails and Waterline.
Example
var total = await User.count({name:'Flynn'});
sails.log(`There ${total===1?'is':'are'} ${total} user${total===1?'':'s'} named "Flynn".`);
Notes
    
   
  
    
    Is something missing?
    If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo.  Once we merge it, the changes will be reflected on the website the next time it is deployed.