I am writing a webapp with Node.js and mongoose. How can I paginate the results I get from a .find()
call? I would like a functionality comparable to "LIMIT 50,100"
in SQL.
Node.js – How to paginate with Mongoose in Node.js
mongodbmongoosenode.jspagination
Related Topic
- Javascript – How to decide when to use Node.js
- Node.js – How to exit in Node.js
- Javascript – the purpose of Node.js module.exports and how do you use it
- Node.js – Using Node.js as a simple web server
- Node.js – How to update NodeJS and NPM to the next versions
- Node.js – Upgrading Node.js to latest version
- Javascript – How to completely uninstall Node.js, and reinstall from beginning (Mac OS X)
- Node.js – How to uninstall npm modules in Node.js
Best Answer
I'm am very disappointed by the accepted answers in this question. This will not scale. If you read the fine print on cursor.skip( ):
To achieve pagination in a scaleable way combine a limit( ) along with at least one filter criterion, a createdOn date suits many purposes.