Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
mongoose-cursor
JavaScript
branch: master

Merge pull request #2 from aldoborrero/master

Fix bug dealing whith next. Bumped version
Failed to load latest commit information.
lib Fix bug dealing whith next. Bumped version
.gitignore Initial commit
.npm-ignore
README.md Update README.md
index.js included cursor
package.json Fix bug dealing whith next. Bumped version

README.md

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
}
Something went wrong with that request. Please try again.