Pagination docs with mongodb driver: http://docs.mongodb.org/manual/reference/method/cursor.skip/#cursor.skip
El lunes, 13 de julio de 2015, 18:31:57 (UTC-5), Lazar Gubezkis escribió: > > I'm trying to use the mongoose-paginate plugin: > https://www.npmjs.com/package/mongoose-paginate > > This is my code, but I'm getting an error: undefined is not a function > > var mongoose = require('mongoose'), > mongoosePaginate = require('mongoose-paginate'), > db = mongoose.connection; > > > > /*********************************************************************************/ > /* Connect to DB */ > > /*********************************************************************************/ > > mongoose.connect('mongodb://localhost/users'); > > db.on('error', console.error.bind(console, 'Connection error:')); > db.once('open', function (callback) { > console.log('Connected to MongoDB!'); > var userSchema = mongoose.Schema({ > firstName: String, > lastName: String, > userName: String, > password: String > }); > > > userSchema.plugin(mongoosePaginate); > > userSchema.paginate({}, { // this is what's causing the error > page: 2, limit: 1 > }, function(err, results, pageCount, itemCount) { > console.log(results); > }); > > }); > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/1a9868c8-bdb1-4b74-9e54-e623fbac80be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
