相关疑难解决方法(0)

如何在猫鼬中使用.slice

我的应用程式中有这个

...
Score.find({ match: {$in: ids}} )
     .sort([[score_sort, 'descending']])
     .slice([skip, limit])
     .exec(function(err, scores) {
    if (err || !scores) {
        throw err;
    } else {
        // do something cool
    }
});
Run Code Online (Sandbox Code Playgroud)

但是使用切片操作时出现错误,错误是:

Error: slice() must be used after where() when called with these arguments
Run Code Online (Sandbox Code Playgroud)

我试图用.where替换.find,但是我仍然遇到相同的错误。有人知道如何解决这个问题吗?

mongoose mongodb node.js

5
推荐指数
2
解决办法
4909
查看次数

标签 统计

mongodb ×1

mongoose ×1

node.js ×1