View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page


Find records in your database that match the given criteria.

Something.find(criteria).exec(function (err, records) {



Argument Type Details
1 criteria The Waterline criteria to use for matching records in the database.
Argument Type Details
1 err The error that occurred, or undefined if there were no errors.
2 records The array of records from your database which match the given criteria.


To find any users named Finn in the database:

User.find({name:'Finn'}).exec(function (err, usersNamedFinn){
  if (err) {
    return res.negotiate(err);
  sails.log('Wow, there are %d users named Finn.  Check it out:', usersNamedFinn.length, usersNamedFinn);
  return res.json(usersNamedFinn);

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-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book