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

Invoking ObjectID with an array generate a "broken" object

    • 2
    • Not Needed

      What problem are you facing?

      When creating a new `ObjectId`, if an array is provided as first parameter of the constructor, an error is not thrown, owever the resulting object doesn't have the `id` property. This means that every call to `toString()` will throw an error (equals, inspect, etc...)

      What driver and relevant dependency versions are you using?

      bson 4.5.3

      Steps to reproduce?

       

      // The following operation should throw an error
      const o = new require('bson').ObjectId([]);
      
      // Instead every subsequent operation on o will likely throw an error
      console.log(o); 

            Assignee:
            grace.chong@mongodb.com Grace Chong (Inactive)
            Reporter:
            daniele.bellavista@protonmail.com Daniele Bellavista
            Daria Pardue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: