mongoose-ranged-paginate

0.1.0 • Public • Published

mongoose-ranged-paginate

Mongoose ORM Document Pagination Based on Ranged Query

Build Status Dependency Status Coverage Status

Features

  • next_max_id
  • count

Installation

Node.js and NPM is required.

$ npm install mongoose-ranged-paginate

Usage

To get 20 MyModels started from 1cdfb22e1f3c000000003152,

require('mongoose-ranged-paginate')

MyModel.find()
    .sort('-_id')
    .paginate(20, '1cdfb22e1f3c000000003152')
    .exec(function (err, models) {
    };

To get 20 latest MyModels

require('mongoose-ranged-paginate')

MyModel.find()
    .paginate(20)
    .exec(function (err, models) {
    };

Or set default count via paginate.count

paginate = require('mongoose-ranged-paginate')
paginate.count = 20

MyModel.find()
    .paginate()
    .exec(function (err, models) {
    };

Contribution

Run Tests

$ npm test

Any contribution is more then welcome!

Package Sidebar

Install

npm i mongoose-ranged-paginate

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • quanlong