Working with nodejs is always an adventure and mix MongoDB with it, and it becomes very interesting for a nodejs enthusiast like me.
While working on a pet project involving Native MongoDb driver and nodejs I encountered a weird problem.
If you’re trying to save a document and saving process somehow exited with an RangeError: Maximum call stack size exceeded exception, it’s related to what you want to save in the database. I had this problem also, and when I checked my object, I found that the problem is related to the big DOM Object that I included in the object, and when I removed that, the object saved in MongoDB correctly.
My piece of buggy code:
While working on a pet project involving Native MongoDb driver and nodejs I encountered a weird problem.
RangeError: Maximum call stack size exceeded
As usual my first thought was to Google out what I was facing and googling it out led me to the following to links.
- RangeError: Maximum call stack size exceeded
Calling Model.collection.save() RangeError: Maximum call stack size exceeded
If you’re trying to save a document and saving process somehow exited with an RangeError: Maximum call stack size exceeded exception, it’s related to what you want to save in the database. I had this problem also, and when I checked my object, I found that the problem is related to the big DOM Object that I included in the object, and when I removed that, the object saved in MongoDB correctly.
My piece of buggy code:
The problem occurred in `secData` array. In the second item of that array I had a big DOM Object and after removing that object from array (and of course, doing that job in a different way), problem solved.collection.insert({ seq: nextSeq, profileIdentity: profileIdentity, sectionData: secData, //the buggy part findDateTime: new Date() });
Same wording:
ReplyDeletehttp://afshinm.name/nodejs-mongodb-and-rangeerror-maximum-call-stack-size-exceeded/
U the same guy?