This time I have problem with querying last X records with certain value from mongodb.
What I have so far ->
Data.find({'ResourceID': 61}, {}, {limit: 10}, function (err, docs) {
res.json(docs);
});
This returns first 10 records. How can I get last 10?
EDIT :
This works, but can I convert this to the looks of the upper or whats the point of this 'exec' function?->
Data.find({
'ResourceID': 61
}).sort('-Start').limit(10).exec(function (err, docs) {
console.log(docs);
res.json(docs);
});