Answers for "mongodb get maximum value from 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

mongodb get max value

db.collection.find().sort({age:-1}).limit(1) // for MAX
db.collection.find().sort({age:+1}).limit(1) // for MIN
Posted by: Guest on February-10-2021
0

mongodb get maximum value from collection

db.collection.find().sort("age",-1).limit(1) // for MAX
db.collection.find().sort("age", 1).limit(1) // for MIN
db.collection.find().sort("age", pymongo.DESCENDING).limit(1) // for MAX
db.collection.find().sort("age", pymongo.ASCENDING).limit(1) // for MIN
Posted by: Guest on August-31-2021
0

mongodb get maximum value from collection

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

mongodb get max value

db.collection.find().sort({age:-1}).limit(1) // for MAX
db.collection.find().sort({age:+1}).limit(1) // for MIN
Posted by: Guest on February-10-2021
0

mongodb get maximum value from collection

db.collection.find().sort("age",-1).limit(1) // for MAX
db.collection.find().sort("age", 1).limit(1) // for MIN
db.collection.find().sort("age", pymongo.DESCENDING).limit(1) // for MAX
db.collection.find().sort("age", pymongo.ASCENDING).limit(1) // for MIN
Posted by: Guest on August-31-2021

Code answers related to "mongodb get maximum value from collection"

Browse Popular Code Answers by Language