I'm trying to insert a bulk of plain objects to mongodb, but something very weird is happening. Let's say i try to insert 1000 objects like this
for (var i = 0; i < 1000; i++) {
var commentAux = {
'a': 'test' + i,
'b': 'https://test.com',
'c': appUser.id,
'd': 'test of' + i
}
comments.push(commentAux);
}
Comment.collection.insert(comments, function (err, docs) {
if (err) {
return res.json({success: false, message: 'Comments Fail'});
}
}
But if I change the 1000 for lets say 1500, the server hangs. It never throws an excetpion, neither a warning, nothing. It just stucks there. I've been reading, and this amount of documents isn't even near the limit amount that mongo supports.
Someone face the same issue? I'm using mongo 3.2 in windows