直接按以下方式创建查询对象可能是最简单的:
Test.find({ $and: [ { $or: [{a: 1}, {b: 1}] }, { $or: [{c: 1}, {d: 1}] } ] }, function (err, results) { ... }但是,您也可以使用
Query#and最新的3.x Mongoose版本中提供的帮助程序:
Test.find() .and([ { $or: [{a: 1}, {b: 1}] }, { $or: [{c: 1}, {d: 1}] } ]) .exec(function (err, results) { ... });


