excuse me.
because of the small amount of data, I directly use find limit skip for paging
there is no problem when I use the code.
var page = 1;
var pageSize = 5;
var count = (page - 1) * pageSize;
Coupon.find({}).limit(pageSize).skip(count).exec(function (err, rs) {
res.json(rs);
})
but you won"t get any data if you use it this way.
var form = new formidable.IncomingForm();
form.parse(req, function (err, fields, files) {
Coupon.find({}).limit(fields.pageSize).skip((fields.page - 1) * fields.pageSize).exec(function (err, rs) {
res.json(rs);
})
});
could you tell me how to solve the problem