using mongodb with mongoose:
My current code returns the correct docs but sends them to the client in the wrong order. I tried adding another sort command after the .limit() to reverse this but it hasn't been working well. Any ideas to make this happen within the db call instead of extra code to reverse the order?
Item.find().sort('_id','descending').limit(40).each(function(err, doc) {
if(doc != null){
client.send(JSON.stringify(doc));
}
});