.find(criteria , [callback])

Purpose

Finds and returns all records that meet the criteria object(s) that you pass it.

Overview

Parameters

Description Accepted Data Types Required ?
1 Find Criteria {},[{}], string, int Yes
2 Callback function Yes

Callback Parameters

Description Possible Data Types
1 Error Error
2 Found Records [{}]

Example Usage

  1. User.find({}).exec(function findCB(err,found){
  2. while (found.length)
  3. console.log('Found User with name '+found.pop().name)
  4. });
  5. // Found User with name Flynn
  6. // Found User with name Jessie
  7. // Don't forget to handle your errors

Notes

Any string arguments passed must be the ID of the record. This method will ALWAYS return records in an array. If you are trying to find an attribute that is an array, you must wrap it in an additional set of brackets otherwise Waterline will think you want to perform an inQuery.