mongoose-paginate-pages

Install

npm install mongoose-paginate-pages

Usage

var paginate = require('mongoose-paginate-pages');

Schema.plugin(paginate);

Model.paginate(query, options, function(err, results, total, pages) {
     ......   
});
  • Options

    • page
    • limit
    • lean
    • sortBy
    • columns
    • populate
  • Callback(err, results, total, pages)

    • results the results of query
    • total equals Model.count(query)
    • pages equals Math.ceil(total / limit)

Test

npm install && npm test

Thanks

edwardhotchkiss/mongoose-paginate

LISCENSE

MIT