Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1298

BulkWrite: Incorrect batch-size calculations causes batch to fail

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.3
    • Affects Version/s: 3.0.1
    • Component/s: Core
    • Environment:
      Windows 10 64bit.
      Node v8.9.4

      Problem:
      bulk's final batch size is NOT sum of all document's bson-size, because batch query is an array, which add additional 4 bytes to each document.

      Example from real use-case
      According to unordered.js:188:
      _self.s.currentBatch.sizeBytes == 16776523

      According to commands.js:141:
      var query = self.bson.serialize(this.query,

      { checkKeys: this.checkKeys, serializeFunctions: this.serializeFunctions, ignoreUndefined: this.ignoreUndefined }

      )
      query.length == 16802161

      Thus, batch fails

            Assignee:
            jessica.lord Jessica Lord
            Reporter:
            bn.omer Omer Ben Nahum
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: