Reputation: 2725
I have written a sorting function but it would not work. I have no idea where am i going wrong.The code below is suppose to sort picture on the basis of points
models.Picture.find().sort({points:-1}).all(function (err, pics){
if(err) {
throw err;
}
pics.forEach(function(pic) {
pictures.push(pic);
})
});
Upvotes: 0
Views: 43