Meteor:超出最大调用堆栈大小

时间:2015-08-08 10:48:53

标签: javascript node.js mongodb meteor

我尝试做一些我已经做过几次的事情,从未遇到过这样的错误。

我只是想在我的流星应用程序中找到他们的X字段等于Y的所有文档:

JS :(模板的助手)

'friendPictures' : function(){
    var currentFriendId = this._id;
    Pictures.find({ownerId: currentFriendId});
    // DO SOMETHING WITH THE PICTURES
}

HTML :(在模板内)

{{#each friend}}
    ...
    {{friendPictures}} // Calling for the helper
    ...
{{/each}}

我在Chrome的控制台中尝试执行“find()”时仍然遇到此错误:

Uncaught RangeError: Maximum call stack size exceeded
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:528:3)
at http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:530:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:529:5)
at http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:530:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:529:5)
at http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:530:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?71047b64b5196348bdbe5fd5eea9ac97a5a9eb14:529:5)

之前有人遇到过这种情况吗?

编辑:

文件示例:

{
     _id: "DCgKA73wNm2mYAhSD",
     base64: "very long string..."
     ownerId: "fRPD87tHkap9hQyB8",
     tags: [
          "nothing",
          "special"
     ]
}

1 个答案:

答案 0 :(得分:1)

您是否尝试过使用fetch()运行它?

Collection.find({pictureId: currentPicId}).fetch();

fetch 将找到的光标变为数组。 但同样,没有更多信息,这个答案可能不相关。