Answers for "mongodb filter max value in collection"

0

mongodb get maximum value from collection

db.collection.aggregate([{
	$group : { _id: null, max: { $max : "$age" }}
}]);
Posted by: Guest on April-05-2021
0

find only one max record in mongodb

db.temp.aggregate([
  {$group: {
      _id: "$total_wins",
      my_winner: {$push: "$$ROOT"}
  }},
  {$sort:{_id:-1}},
  {$limit:1}  ]).pretty()
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language