Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Latest commit

 

History

History
46 lines (30 loc) · 996 Bytes

README.md

File metadata and controls

46 lines (30 loc) · 996 Bytes

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

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

Run Tests

$ npm test

Bitdeli Badge