balderdashy / waterline-docs

WARNING: The content in this repo is out of date! See https://github.com/balderdashy/sails-docs for the most up-to-date documentation
452 stars 163 forks source link

How can we filter by using child tables #134

Open anaspa opened 7 years ago

anaspa commented 7 years ago

Hi How can we change the below one as

User.find() .populate('pets') .exec(function(err, users) { if(err) // handle error

// The users object would look something like the following // [{ // id: 123, // firstName: 'Foo', // lastName: 'Bar', // pets: [{ // id: 1, // breed: 'labrador', // type: 'dog', // name: 'fido', // user: 123 // }] // }] });

to find all users who has pet type is dog