Waterline.find()

Find records from this model that match the specified criteria, and optionally populate their associations.

Usage

Hover over inputs/exits for more info.

var Waterline = require('machinepack-waterline');


// Find records from this model that match the specified criteria, and optionally populate their associations.

Waterline.find({

model: 'user',

select: [ 'foo' ],

where: {},

limit: -1,

skip: 0,

sort: [ 'name ASC' ],

populate: [ { association: 'friends', select: [ 'foo' ], where: {}, limit: -1, skip: 0, sort: [ 'name ASC' ] } ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The provided `select`, `where`, `limit`, `skip`, `sort`, and/or `populate` was invalid.

invalidCriteria: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

model required

'user'
select

[ 'foo' ]
where

{}
limit

-1
skip

0
sort

[ 'name ASC' ]
populate

An array of assocations to populate.

[ { association: 'friends',
    select: [ 'foo' ],
    where: {},
    limit: -1,
    skip: 0,
    sort: [ 'name ASC' ] } ]

Exits

error

An unexpected error occurred.

invalidCriteria

The provided `select`, `where`, `limit`, `skip`, `sort`, and/or `populate` was invalid.

success

OK.

[ {} ]