Thomas Thomas - 11 months ago 69
Node.js Question

How to paginate with Mongoose in Node.js?

I am writing a webapp with Node.js and mongoose. How can I paginate the results I get from a

call? I would like a functionality comparable to
"LIMIT 50,100"
in SQL.


After taking a closer look at the Mongoose API with the information provided by Rodolphe, I figured out this solution:

MyModel.find(query, fields, { skip: 10, limit: 5 }, function(err, results) { ... });