Meteor:RangeError:超出最大调用堆栈大小 [英] Meteor: RangeError: Maximum call stack size exceeded
本文介绍了Meteor:RangeError:超出最大调用堆栈大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误
W20141210-18:14:54.394(5.5)? (STDERR)
W20141210-18:14:54.395(5.5)? (STDERR) /Users/removed/.meteor/packages/meteor-tool/.1.0.36.1phxfod++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141210-18:14:54.395(5.5)? (STDERR) throw(ex);
W20141210-18:14:54.395(5.5)? (STDERR) ^
W20141210-18:14:54.396(5.5)? (STDERR) RangeError: Maximum call stack size exceeded
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
当我使用meteor方法返回查询结果时。
When I am using meteor methods to return a query result.
Meteor.methods({
rquery: function(post){
console.log(post);
var result = AdvtColl.find();
return result;
}
});
推荐答案
您无法从方法返回游标 - 只有 EJSON 。在你的代码中,结果
是一个 find
调用的结果,这是一个游标 - 你需要使用 findOne
或在 find()
之后添加 fetch()
返回有问题的文件。
You can't return a cursor from a method - only EJSON. In your code, result
is the result of a find
call, which is a cursor - you need to either use findOne
or add fetch()
after the find()
to return the document(s) in question.
var result = AdvtColl.findOne(); // RETURNS A DOCUMENT
var result = AdvtColl.find().fetch(); // RETURNS AN ARRAY OF DOCS (EVEN IF THERE'S ONLY ONE OF THEM)
这篇关于Meteor:RangeError:超出最大调用堆栈大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文