node.js的数据库查找出错
发布于 8 年前 作者 Nomadcheng 2941 次浏览 来自 问答

exports.list = function(req, res) { var index = parseInt(req.query.pageIndex) || 1; Report.fetch(index, function(err, reports) { if (err) { console.log(err); } res.render(‘admin/reportlist’, { title: ‘心理咨询列表’, isFirstPage: (index - 1) == 0, isLastPage: 0, page1: index-1, page2: index+1, reports: reports }); }); }; fetch: function(page, cb) { return this .find({ skip: (page - 1) * 5, limit: 5 }) .sort(‘meta.updateAt’) .exec(cb) }

请问为什么了加了判断条件
            skip: (page - 1) * 5,
            limit: 5
就查不出一条数据呢?
1 回复

.find({}) .skip((page - 1) * 5) .limit(5) .sort(‘meta.updateAt’) .exec(cb)

回到顶部