mongoose-paginate
Mongoose ORM (NodeJS/MongoDB) Document Query Pagination
To be used in combination with view pagination middleware such as express-paginate.
Installation
npm install -S mongoose-paginate
Usage
Basic
/* * basic example usage of `mongoose-pagination` * querying for `all` {} items in `MyModel` * paginating by second page, 10 items per page (10 results, page 2) */ var mongoosePaginate = ; MyModel MyModel;
Advanced
/* * basic example usage of `mongoose-pagination` * querying for `{ columns: 'title', { populate: 'some_ref' }, sortBy : { title : -1 } } items in `MyModel` * paginating by second page, 10 items per page (10 results, page 2) */ var mongoosePaginate = ; MyModel MyModel;
Run Tests
$ npm test