mongoose-paginate

Mongoose ORM (NodeJS/MongoDB) Document Query Pagination

npm install mongoose-paginate
18 downloads in the last day
68 downloads in the last week
218 downloads in the last month

mongoose-paginate - Build Status

Mongoose ORM (NodeJS/MongoDB) Document Query Pagination

Installation

$ npm install mongoose-paginate

Usage


/*
 * 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 mongoose = require('mongoose-paginate');

MyModel.paginate({}, 2, 10, function(error, pageCount, paginatedResults, itemCount) {
  if (error) {
    console.error(error);
  } else {
      console.log('Pages:', pageCount);
    console.log(paginatedResults);
  }
});

Run Tests

$ npm test

Author: Edward Hotchkiss

Bitdeli Badge

npm loves you