node.js - RangeError: Maximum call stack size exceeded Nodejs mongoose -


wanted test speed of inserting new documents in database mongodb, however, when amount of insertion large, returns following error: "rangeerror: maximum call stack size exceeded" can tell me why message?

var counters2schema = new mongoose.schema({'_id': objectid, 'seq':string}, { versionkey: false, collection: 'counters'  }),  var k = 100000; testcupwrite function (i) {      var myobjectid = mongoose.types.objectid;      myobjectid = new myobjectid();      var counters2model = new mongoose.model("counters", counters2schema);      new counters2model({'seq': myobjectid}). save ();      console.log ('teste_' + myobjectid);      if (i <k) {          + +;          settimeout (testcupwrite (i), 1);      }  } testcupwrite (0); 

thank you

this line:

settimeout (testcupwrite (i), 1); 

is not doing think is. that's directly executing testcpuwrite function in current stack. it's not using settimeout think. like

settimeout(testcupwrite.bind(null, i), 1); 

might going.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -