mongodb get maximum value from collection

db.collection.aggregate([{
	$group : { _id: null, max: { $max : "$age" }}
}]);

4.2
10
OnWords 100 points

                                    db.collection.find().sort({age:-1}).limit(1) // for MAX
db.collection.find().sort({age:+1}).limit(1) // for MIN

4.2 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
mongodb max number of documents in collection mongodb max value of field get highest in mongo mongodb property max value max mongo c# syntax to get max value from mongodb document c# syntax to get max value from mongo document mongo engine query max value mongo compass query to find max value mongo query to find max value get max value nodejs mongodb mongodb max amount of properties mongodb query max value query in mangodb for selecting max value mongodb 3.0 query max value mongodb c# find max value find max value in c# from mongodb how to get max value in mongodb mongodb column max limit mongodb aggregate max value mongodb get max with extra fields getting max value mongo collection java mongo find and max mongodb query max Pymongo find max value fget the max of field value mongo db mongodb find largest values in collection how to get max value for particular attr in mongodb select max mongodb select max value mongodb valeur max mongodb mongodb find max document mongodb find max mongodb find max value in collection python mongodb find max value in collection mongodb query to set min max value mongodb get max value max value of a att in mongo max value mongodb mongodb how to use $max mongo db max value find find max value of field in mongo get max value of field in mongo how to find document with max value in monogdb how to find max of any attribute in mongodb mongodb find max attribute java code to get max value field mongodb get max value field mongodb java pymongo find max value of a field pymongo get max value of field maxdistance mongodb mongodb get document with max value mongodb maximum in values in filter mongodb how to get min and max mongodb aggregate get max value mongodb one max value monogo db one max value find maximum in mongo db mongodb query to find max value aggregate mongodb get max value record maxdistance in mongodb max mongo match mongodb query $max value price mongodb query max value price mongodb $max mongodb $max with date mongodb get field where maximum is how to find maximum of 5 data in mongo db get max mongodb find max value in mongodb find maximum value in object mongodb mongodb maximum integer value maximum number of properties mongodb $maxdistance value mongodb mongodb queris get collection with maximum find max in mongodb find limit max mongodb limit max mongodb find max value object in collection mongodb nodejs mongodb find max value for multiple documents find max value object in collection mongodb find max value in collection mongodb find max value in collection mongodbv find the biggest value in collection mongodb Find max value in MongoDB c# how to get the max value from a column in mongodb mongodb find highest value get max value mongodb get the max of some column mongodb mongodb find max record with max id pymongo mongodb find max record with max id find highest number mongodb max value of key in mongodb $maxdistance mongodb max length mongodb model max length mongodb how to find max in mongodb stroe min and max value in mongodb find max value mongodb get max value in mongodb python mongo get the maximum value mongodb max field length Maximum number of collections in MongoDB mongodb number type max value how to get max value mongodb max value usin mongodb mongodb get document with maximum value from collection mongodb get maximum value from collection get max in mongodb maxtimems mongodb mongodb max function mongodb find max value of a field mongodb find max value mongodb get maximum value how to get max from count mongodb mongo get max value how to find max value in mongodb $max mongodb mongodb get max value between all documents mongodb get highest value mongodb get max value of field mongodb get max value of column mongo find highest value mongodb max value in collection max value in mongodb find max mongodb mongodb max value max mongodb mongodb select max value display max in mongodb max of values mongo query max in mongodb max function in mongodb mongodb number max value $max in mongodb
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source