Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor: Maximum call stack size exceeded

I try to do something I already did a few times, never encountering such error.

I simply want to find all documents that their X field equals Y in my meteor app:

JS: (helper of template)

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

HTML: (inside the template)

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

I keep getting this error when trying to do the "find()", also in Chrome's console:

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)

Anyone got into this situation before?

EDIT:

Example of the document:

{
     _id: "DCgKA73wNm2mYAhSD",
     base64: "very long string..."
     ownerId: "fRPD87tHkap9hQyB8",
     tags: [
          "nothing",
          "special"
     ]
}
like image 561
Maboo Avatar asked Aug 08 '15 10:08

Maboo


People also ask

How do I stop max call stack size exceeded?

How to Avoid RangeError: Maximum Call Stack Size Exceeded. If this error is encountered when calling recursive functions, it should be ensured that the function has a defined base case to terminate the recursive calls.

What is maximum call stack size exceeded?

The JavaScript exception "too much recursion" or "Maximum call stack size exceeded" occurs when there are too many function calls, or a function is missing a base case.

What does maximum call stack size exceeded mean Karel?

It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you hit the call stack limit. This is almost always because of a recursive function with a base case that isn't being met.


1 Answers

Have you tried running it with fetch()?

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

fetch turns the found cursor into an array. But again, without more info this answer might not be relevant.

like image 142
Ido Avatar answered Oct 05 '22 23:10

Ido