Articles → MONGODB → $Min And $Max Operators In Mongodb

$Min And $Max Operators In Mongodb






Sample Collection




Picture showing the sample mongodb collection



$Min Operator






db.mycollection.updateOne({ _id: ObjectId("6597b8a02695219f3c55e481")},{$min:{age:27}})


Picture showing the output of $min operator in mongodb



$Max Operator






db.mycollection.updateOne({ _id: ObjectId("6597b8a02695219f3c55e481")},{$max:{age:29}})




Picture showing the output of $max operator in mongodb





Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, March 19, 2024

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250