Maboo
Maboo

Reputation: 425

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"
     ]
}

Upvotes: 6

Views: 2596

Answers (1)

Ido
Ido

Reputation: 81

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.

Upvotes: 1

Related Questions