I am trying to do a "$in" query with waterline I have an Array and I want to get a list of document with ids that are in the array. I don't know how to do that.
I tried:
User.find()
.where({id : {in : array}})
done(...)
But it doesn't seem to work as expected.
Any way I can do that?
ParticleBanana answered me here: https://groups.google.com/forum/#!topic/sailsjs/dHxwsJvG5V8
I quote him here for convenience:
When an array is passed in the where criteria an IN query will automatically be run. So you can do the following:
User.find().where({ id: [1,2,3] }).exec(function(err, users) { ... })`
It worked perfectly.
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