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

Missing shallow copy in DB.collection

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.1
    • Affects Version/s: 3.1.0
    • Component/s: Native

      3.1 got released a couple of hours ago and took down my server. The issue looks to be a bug in 3.1 that is triggered by a bug in my code.

      For some reason my code was doing:

      const collection = this.db.collection(name, name);

      i.e. passing a string to the options arg. This worked in 3.0 but breaks in 3.1. The reason is that in 3.1 the shallow copy is broken.

      3.0: https://github.com/mongodb/node-mongodb-native/blob/3.0/lib/db.js#L412
      3.1: https://github.com/mongodb/node-mongodb-native/blob/master/lib/db.js#L316
       
      Not the object.assign isn't assigned to options? I presume it should read
      options = Object.assign({}, options);

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            bladedancer Gavin Matthews
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: