0.13.3 • Published 9 years ago
mongoose-paginate-cursor v0.13.3
mongoose-paginate-cursor
Installation
npm install mongoose-paginate-cursor
Usage
// body parser
var mongoose = require('mongoose');
var mongoosePaginate = require('mongoose-paginate-cursor');
var ModelSchema = mongoose.Schema({
title: String,
count: Number
});
ModelSchema.plugin(mongoosePaginate,{
// name: 'paged' // custom name of paginate function
})
var Model = mongoose.model('MyModel', ModelSchema);
var paged = await Model.paginate({
sinceId, // from what value to get documents (default: null)
maxId, // to what value to get documents (default: null)
limit, //amount of documents to get on search (default: 1)
select, //what values get on request
where, // query to match the search
keyPaginated, //key to paginate on document (ejm: 'count' ) (default: '_id')
reverse, //tell the pagination to reverse the search
});
paged.objects // objects found
paged.nextCursor // the key value of the next cursor.paginate() returns a promise, or can be used with a callback
.paginate({},callback)
Features to have
- Map: let the user map the documents
- QueryMap: let the user map the query to add chain calls
- Filter: filter documents and search more to reach the limit
- beforeCursor: cursor for before request
License: MIT
1.0.1
9 years ago
1.0.0
9 years ago
0.13.3
9 years ago
0.13.2
9 years ago
0.13.1
9 years ago
0.13.0
9 years ago
0.12.9
10 years ago
0.12.8
10 years ago
0.12.7
10 years ago
0.12.6
10 years ago
0.12.5
10 years ago
0.12.4
10 years ago
0.12.3
10 years ago
0.12.0
10 years ago
0.11.0
10 years ago
0.10.3
10 years ago
0.10.2
10 years ago
0.10.1
10 years ago
0.10.0
10 years ago
0.9.0
10 years ago
0.8.1
10 years ago
0.8.0
10 years ago