xxxxxxxxxx
Blah.find({}).sort({date: -1}).execFind(function(err,docs){
//code
});
-1 for descending & 1 for ascending
xxxxxxxxxx
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) { });
xxxxxxxxxx
// sort by "field" ascending and "test" descending
query.sort({ field: 'asc', test: -1 });
// equivalent
query.sort('field -test');