Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92055

nInserted can return an incorrect count for multi-batch inserts

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • 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.

            Assignee:
            kristina.znam@mongodb.com Kristina Znam
            Reporter:
            colin.stolley@mongodb.com Colin Stolley
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: