mongoose find all with condition code example
Example 1: mongoose find multiple conditions
User.find({$or:[{region: "NA"},{sector:"Some Sector"}]}, function(err, user)
{
if (err)
{
res.send(err);
}
console.log(user);
res.json(user);
});
Example 2: mongoose search by name
let ids = ['id1','id2','id3']
let data = await MyModel.find(
{'_id': { $in: ids}}
);