Open anaspa opened 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
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