-
Type:
Bug
-
Status: Closed
-
Priority:
Major - P3
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: JavaScript
-
Labels:None
-
Operating System:ALL
-
Steps To Reproduce:
When executing a batch update for one of our collections(5806 docs) we suddenly get a:
error: MongoError: BSONObj size: 16797454 (0x1004F0E) is invalid. Size must be between 0 and 16793600(16MB) First element: update: "collection_name"
|
using the node native driver at 3.1.10 on latest mongo 4.0 series @atlas
const bulk = db.collection(coll).initializeUnorderedBulkOp()
|
docs.forEach((\{query, update}) => bulk.find(query).updateOne(update)
|
bulk.execute()
|
While I managed to work around this issue by using manually decreasing the batch size via
let bulk = db.collection(coll).initializeUnorderedBulkOp();
|
let counter = 0;
|
for (const \{query, update} of docs) {
|
bulk.find(query).updateOne(update);
|
counter++;
|
if ( counter % 500 == 0 ) {
|
bulk.execute();
|
counter = 0;
|
bulk = db.collection(coll).initializeUnorderedBulkOp();
|
}
|
}
|
as i get the docs this should be handled internally.
- is caused by
-
NODE-1778 BulkWrite: Incorrect batch-size calculations causes batch to fail
-
- Closed
-