CNode

node.js的数据库查找出错

问答
NNomadcheng发布于10 年前最后回复10 年前1 回复4081 浏览0 收藏

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)

L
LiangCY#1·10 年前

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

参与回复
登录后即可参与回复。登录