select _id from project where projectName = '***' order by viewCount desc limit 5
Being relatively new to working with mongoose and having a decent grasp on SQL, I've tried my hand at retrieving the ObjectId
of the sorted results.
ProjectModel.find({id}).sort({viewCount: -1}).limit(5).exec(
function(err, projects) {
...
}
);