var q = models.Post.find().sort('date', -1).limit(10);
q.execFind(function(err, posts) {
// previous 6 to 10th records needed.
});以上将查询最后10条记录。我可以放弃前5条:-
posts.splice(0, 4); 去获得第6至第10项记录。但是,是否有直接的方法来直接查询这样的集合呢?喜欢
var q = models.Post.find().sort('date', -1).limit(5 to 10);发布于 2013-11-16 20:11:37
我猜你是在找
models.Post.find().skip(5).limit(5)下面的查询适用于猫鼬--请注意,我的模式可能与您的不同:
> Post.find().skip(5).limit(5).exec(function(err, p) { if (err) { console.log("error"); }; console.log(p); })https://stackoverflow.com/questions/20022674
复制相似问题