mongoose-cursor

0.0.4 • Public • Published

mongoose-cursor

Based on https://github.com/edwardhotchkiss/mongoose-paginate

An example extracted from Parkuik (www.parkuik.com) source code:

exports.parkingsPagination = function(req, res) {
  var page = req.query.page;
    var Parking = mongoose.model('Parking');
    Parking
        .find()
        .paginate(page, 10, function(err, results, total) {
            res.json(total);
            return;
        })
}

The structure for the response (for example, if you want to use res.json()):

{
    data: [
        ...
    ],
    next: 1
}

Readme

Keywords

none

Package Sidebar

Install

npm i mongoose-cursor

Weekly Downloads

0

Version

0.0.4

License

BSD

Last publish

Collaborators

  • javiermanzano