-- mongdbo
db.people.find(
{ age: { $gt: 25 } }
)
-- sql
SELECT *
FROM people
WHERE age > 25
-- mongdbo
db.people.find(
{ age: { $lt: 25 } }
)
-- sql
SELECT *
FROM people
WHERE age < 25
-- mongodb
db.people.find(
{ age: { $gt: 25, $lte: 50 } }
)
-- sql
SELECT *
FROM people
WHERE age > 25
AND age <= 50
db.yourDataBase.find({counter:{$gt:2}})
collection.find( { $expr: { $gt: [ "$field1" , "$field2" ] } } )
#field1 greater than field2
db.yourDatabaseName.find(counter:{$lt:100})
exports.test = async (req, res, next)=>{
/*date: {
$gte:ISODate("2013-11-19T14:00:00Z"),
$lt: ISODate("2013-11-19T20:00:00Z")
}
*/
let today = new Date();
let all_users = await User.find({created_at: {$lte: today}}).sort({_id:-1}).countDocuments();
res.render("test1", {docs: all_users});