-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 6.11.0
-
Component/s: BSON
BSON.calculateObjectSize reports incorrect sizes when using BigInt.
In most cases it the effect is minor, but I have cases where it causes a bulkWrite / insertMany command to fail with an error like this:
MongoBulkWriteError: BSONObj size: 16814023 (0x1008FC7) is invalid. Size must be between 0 and 16793600(16MB) First element: insert: "mycollection"
Because the calculated size is less than the actual size, the batch split is done at the incorrect point, causing failures.
Here is a contrived script demonstrating the issue: https://gist.github.com/rkistner/467d2c91b985d4b89ef86720a38ec30e
Also see an example of this happening in real life (with a workaround of limiting batches to 15MB): https://github.com/powersync-ja/powersync-service/pull/154
- is duplicated by
-
NODE-5153 Add bigint support to BSON calculateObjectSize
-
- Closed
-