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

ObjectId.equals throws vague error two bson packages are loaded

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      What problem are you facing?

      If you have a package with a dependency on `bson` and a host package that also has a dependency on `bson`, and you try and compare `ObjectId` classes using the `equals` method you get a very vague message like below.

      ```
      TypeError: Cannot read properties of undefined (reading '11')
      ```
       

      What driver and relevant dependency versions are you using?

      using bson package version 6.2.0

      Steps to reproduce?

      i made a super simple github repo that reproduces this issue, see readme about how to run it.

       

      https://github.com/tommyk/bson-object-equals-bug

            Assignee:
            Unassigned Unassigned
            Reporter:
            tommy_k38@yahoo.com tommy N/A
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: