I am trying to retrieve one element from a mongo collection, the one with the greatest _id field. I know this can be done by querying:
db.collection.find().s
You can get max _id using aggregation of mongodb. Find and sort may overkill's.
db.myCollection.aggregate({ $group: { _id: '', last: { $max: "$_id" } } });