To use Node Mongoose Find with multiple conditions, we put all the conditions in one object.
For instance, we write
User.find(
{ $or: [{ region: "NA" }, { sector: "Some Sector" }] },
(err, user) => {
if (err) {
res.send(err);
}
console.log(user);
res.json(user);
}
);
to call find
with an object with $or
set to an array of conditions we’re looking for.
And we get the result from user
in the callback.