O'Reilly logo
  • Patrick S thinks this is interesting:

The earlier code could be rewritten using the dot syntax method as in the following:

User.find({'name' : 'Simon Holmes'})
.where('age').gt(18)
.sort('-lastLogin')
.select('_id name email')
.exec(function (err, users){
  if (!err){
    console.log(users); // output array of users found
  }
});

From

Cover of Mongoose for Application Development

Note

using QueryBuilder to build up over multiple steps