Answers for "mongodb sort and limit in aggregation"

1

how to sort and limit the result using mongodb

db.Employee.find().limit(2).sort({age:-1})
Posted by: Guest on May-05-2021
1

aggregation with size and sort mongodb

> db.demo33.aggregate({$unwind:"$ListOfStudent"}, { $group : {_id:'$_id', ct:{$sum:1}}}, { $sort :{ ct: -1}} );
Posted by: Guest on September-06-2020

Code answers related to "mongodb sort and limit in aggregation"

Browse Popular Code Answers by Language