UNPKG

mongoose-aggregate-paginate-v2

Version:

A page based custom aggregate pagination library for Mongoose with customizable labels.

18 lines (13 loc) 541 B
const mongoose = require("mongoose"); const aggregatePaginate = require("./lib/mongoose-aggregate-paginate"); /** * @param {Schema} schema */ module.exports = function (schema) { schema.statics.aggregatePaginate = aggregatePaginate; mongoose.Aggregate.prototype.paginateExec = function (options, cb) { return this.model().aggregatePaginate(this, options, cb); }; }; module.exports.aggregatePaginate = aggregatePaginate; module.exports.PREPAGINATION_PLACEHOLDER = aggregatePaginate.PREPAGINATION_PLACEHOLDER;