How do you do more advance queries with Mongoose? Specifically a query using $or How do you do more advance queries with Mongoose? Specifically a query using $or mongoose mongoose

How do you do more advance queries with Mongoose? Specifically a query using $or


It should be the same in mongoose.

SomeObjects.find({$or : [{a: 3}, {b: 4}]});

Note I also would like to be able to do this with the findOne() method, but I'm assuming that it'll act just the same as find() with a limit on it

Yea, that should work as well.


i don't think you need to find anything here as mongoose has helpers for that (not sure if this was the case at the time of the post though):

query.or([{ color: 'blue' }, { color: 'red' }]);

mongoose query doc