当前位置: 代码迷 >> JavaScript >> Meteor:超出最大调用堆栈大小
  详细解决方案

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

热度:120   发布时间:2023-06-07 11:47:05.0

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

我只是想在我的流星应用程序中找到他们的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"
     ]
}

你试过用fetch()运行它吗?

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

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