想测试在数据库mongodb中插入新文档的速度,但是当插入量很大的时候,返回如下错误:“RangeError: Maximum call stack size exceeded” 谁能告诉我为什么会收到这个消息?
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) {
i + +;
setTimeout (testCUPwrite (i), 1);
}
}
testCUPwrite (0);
谢谢