-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
Fully Compatible
-
ALL
-
QE 2024-07-22
nInserted only shows the number of documents inserted in the final batch of a multi-batch insertion. This is in contrast with keysInserted, which maintains the total across all batches.
The reason for this behavior difference can be traced to here https://github.com/mongodb/mongo/blob/f2969290887015dbceeebffdcdd5a563863b0a02/src/mongo/db/ops/write_ops_exec.cpp#L1147 in which we reset the nInserted value across batches.
It's likely this line was added only to initialize the value, but has a now-unintended consequence of resetting this value to zero when a value exists from the previous batch.
We should determine if this behavior is intended and if not, avoid resetting this value if it already has one.