Friday, 28 April 2017

Node.js, Mongo find last 10 items sort by start date

I'm here asking again :)

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?

Thanks :)



via Jack M.

No comments:

Post a Comment