猫鼬的表现?或限制

时间:2014-06-05 09:21:37

标签: node.js mongoose

我有一个有65000件物品的藏品。

当我通过下面的Mongoose api发送查询时,它会正常工作,直到它跳过24254。

var getLiveDoc = function(callback){
  LiveDoc.find({},{},{skip:offset, limit:9, sort:{listOrder:1}},callback);
}

当它达到24255时,它会因foll

而失败
ReferenceError: /home/ubuntu/nodetest1/views/error.html:38 body is not defined at buf.push.__stack.lineno (eval at <anonymous> (/home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:1330) at eval (eval at <anonymous> (/home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:31:23) at eval (eval at <anonymous> (/home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:31:80) at /home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:255:15 at Object.exports.render (/home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:293:13) at View.exports.renderFile [as engine] (/home/ubuntu/nodetest1/node_modules/ejs/lib/ejs.js:323:20) at View.render (/home/ubuntu/nodetest1/node_modules/express.io/node_modules/express/lib/view.js:76:8) at Function.app.render (/home/ubuntu/nodetest1/node_modules/express.io/node_modules/express/lib/application.js:504:10) at ServerResponse.res.render (/home/ubuntu/nodetest1/node_modules/express.io/node_modules/express/lib/response.js:798:7) at Object.module.exports [as handle] (/home/ubuntu/nodetest1/app.js:75:9)

当我在mongo控制台中运行相同的查询时,它工作正常。

对此有何想法?

1 个答案:

答案 0 :(得分:0)

如果将Express.js与Body-Parser中间件一起使用,请将限制参数添加为以下行;

app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ extended: false, limit: '50mb' }));

我希望这有帮助..