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

XMLWordPrintableJSON

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

      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
              Reporter:
              TPM Jira Automations Bot
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: