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

Bulk operation's .length should be a propery, not a function.

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.23
    • Affects Version/s: 2.0
    • Component/s: None

      Currently bulk operation's .length is a function.

      This is extremely confusing for developers beacuse .length is defined as property in JavaScript world.

      Because exception is thrown when execute is called on empty bulk object developer needs to guard `execute` call with condition. This leads to silent bugs because `.length` is a function and this common, naturally looking statement is incorrect (will always branch to false):

      
      

      if (bulk.length > 0)

      { bulk.execute(done) }

      else

      { setImmediate(done) } {/code}

      In order to resolve this issue `.length` property should be declared as read only property.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            mirek Mirek Rusin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: