db.collection.find().sort({age:-1}).limit(1) // for MAX
db.collection.find().sort({age:+1}).limit(1) // for MIN
it’s completely usable but i’m not sure about performance
More Related Contents:
- Random record from MongoDB
- Find in Double Nested Array MongoDB
- MongoDB: upsert sub-document
- Add new field to every document in a MongoDB collection
- Check that Field Exists with MongoDB
- How do I update Array Elements matching criteria in a MongoDB document?
- Get a count of total documents with MongoDB when using limit
- ‘Failed to unlink socket file” error in MongoDB 3.0
- To what level does MongoDB lock on writes? (or: what does it mean by “per connection”
- Mongo order by length of array
- Best practice to maintain a mgo session
- MongoDB group by array inner-elements
- Exception: can’t convert from BSON type EOO to Date
- MongoDB on a Windows 7 machine: No connection could be made
- Problems to run examples in Meteor
- mongodb.conf bind_ip = 127.0.0.1 does not work but 0.0.0.0 works
- How to use Elasticsearch with MongoDB?
- Meteor: difference between names for collections, variables, publications, and subscriptions?
- MongoDB – how to query for a nested item inside a collection?
- Get BinData UUID from Mongo as string
- Get n-th element of an array in MongoDB
- What’s the fastest way to copy a collection within the same database?
- Mongoose: deep population (populate a populated field)
- Getting a distinct aggregation of an array field across indexes
- How to get back the new value after an update in a embedded array?
- Unique IDs with mongodb
- Cannot import mongodb
- MongoDB count() versus countDocuments()
- mongodb : Increasing max connections in mongodb
- Create filter aggregation in spring