Quantcast
Channel: Combine two OR-queries with AND in Mongoose - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by JohnnyHK for Combine two OR-queries with AND in Mongoose

It's probably easiest to create your query object directly as: Test.find({ $and: [ { $or: [{a: 1}, {b: 1}] }, { $or: [{c: 1}, {d: 1}] } ] }, function (err, results) { ... }But you can also use the...

View Article


Combine two OR-queries with AND in Mongoose

I want to combine two OR-queries with AND in Monoose, like in this SQL statement:SELECT * FROM ... WHERE (a = 1 OR b = 1) AND (c=1 OR d=1)I tried this in a NodeJS module which only gets the model...

View Article
Browsing latest articles
Browse All 2 View Live