murarisumit
0
Q:

get the latest field in mongodb collection

db.collection.find().limit(1).sort({$natural:-1})
2
> db.collection.findOne().sort({'_id':-1}).limit(1)

It work perfectly !
1
db.collection.find().limit(1).sort({$natural:-1})
0

New to Communities?

Join the community