Reputation: 5125
I have a mongo model and I would like to search for multiple objects with different properties at the same time.
model.find({uuid: 235q422462}, {uuid: 435q4235239}, function(err, objects){
if(err){
console.log(err)
} else {
console.log(objects)
}
});
and then have it return both objects. Currently this is not working. Is there some way I can do this in mongo/mongoose?
Upvotes: 0
Views: 36
Reputation: 12914
You can use the $in operator:
db.model.find( { uuid: {$in:[235q422462, 235q422462}})
or the $or operator to achieve this:
db.model.find( { $or: [ { uuid: 235q422462 }, { uuid: 235q422462 } ] } )
Upvotes: 1