Thomas Thomas - 4 months ago 12x
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) { ... });