Here in this blog i will discuss the conditional operator in MOngo db
db.collection.find({ "field" : { $gt: value } } ); // greater than : field > value db.collection.find({ "field" : { $lt: value } } ); // less than : field < value db.collection.find({ "field" : { $gte: value } } ); // greater than or equal to : field >= value db.collection.find({ "field" : { $lte: value } } ); // less than or equal to : field <= value
db.things.find({j : {$lt: 3}}); db.things.find({j : {$gte: 4}});
db.collection.find({ "field" : { $gt: value1, $lt: value2 } } ); // value1 < field < value