how to sort in mongoose code example
Example 1: mongodb sort query
db.Employee.find().sort({Employeeid:-1}).forEach(printjson)
Example 2: mongoose find sort
Post.find({}).sort('test').exec(function(err, docs) { ... });
Post.find({}).sort([['date', -1]]).exec(function(err, docs) { ... });
Post.find({}).sort({test: 1}).exec(function(err, docs) { ... });
Post.find({}, null, {sort: {date: 1}}, function(err, docs) { ... });
Example 3: sort mongoose response
Blah.find({}).sort({date: -1}).execFind(function(err,docs){
});
-1 for descending & 1 for ascending