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

Investigate NODE-3662 - Invoking ObjectID with an array generate a "broken" object

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 0
    • Not Needed

      NODE-3662 Description

      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:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: