0.1.0 • Published 10 years ago

mongoose-ranged-paginate v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

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!