sort with limit mongodb code example
Example 1: how to sort and limit the result using mongodb
db.Employee.find().limit(2).sort({age:-1})
Example 2: how to sort and limit the result using mongodb
for more information see this
https://www.guru99.com/mongodb-query-modifications-using-limit-sort.html