mongodb get latest document code example
Example 1: mongodb shell query last document
db.collection.find().limit(1).sort({$natural:-1})
Example 2: get the latest field in mongodb collection
db.collection.find().limit(1).sort({$natural:-1})
db.collection.find().limit(1).sort({$natural:-1})
db.collection.find().limit(1).sort({$natural:-1})