I'm bit new at node.js/sails.js and was wondering (if possible) how to retrieve multiple database entries by searching for their ids - there is something like this mentioned in the MongoDB documentation:
db.inventory.find( { qty: { $in: [ 5, 15 ] } } )
And here is what i've tried:
// users param example: 12341243124, 1231231231, 21312313212
var users = req.param('users').split(',');
User.find({id: { $in: users }}, function (err, response) {
// do something here
});
Any help would be appreciated! Thanks!
Sorry for bothering - as it turns out Waterline supports array parameters - so by changing the code above a bit i got this to work:
User.find()
.where({id: users})
.exec(function (err, response) {
// do stuff
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With