I want to sort the result of the mongodb query I was doing some practice on it but I can't get the result as it was expected to do so here is the code
ro.find(function(err,objs){
if(err) res.write('{"Find Error":"'+err.err+'"}');
else {
// Get our data from the collection store
objs.sort(date).toArray(function(error, items)
{`
if(error)res.write('{"Find Error":"'+error.err+'"}');
else{
res.write(JSON.stringify(items));
es.end();
}
});
}
});//