Articles → MONGODB → $Min And $Max Operators In Mongodb
$Min And $Max Operators In Mongodb
Sample Collection
$Min Operator
db.mycollection.updateOne({ _id: ObjectId("6597b8a02695219f3c55e481")},{$min:{age:27}})
$Max Operator
db.mycollection.updateOne({ _id: ObjectId("6597b8a02695219f3c55e481")},{$max:{age:29}})