arozwalak
1/25/2016 - 11:29 PM

MongoDB: sorting

MongoDB: sorting

var cursor = db.collection('collname').find(query);

cursor.project(projection);
cursor.sort({founded_year: 1}); // sort by 'founded_year' ascending