Reputation: 23544
I'm trying to do a batch insert into mongodb with an array that contains about 40,000 objects. I keep getting errors that the BSON document is too large, however if I insert each item individually, it works fine.
Is there a limit to the total insert size or another reason why this would happen? The actual individual documents are all small.
Thanks!
Upvotes: 1
Views: 3382
Reputation: 43884
BatchInsert takes a BSON document as its input as such it is saying that using all 40,000 at the same time is too much. You need to break them down into batches which will fit into a single BSON document.
Upvotes: 2