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

Investigate NODE-3962 - ObjectiId's _bsontype is ObjectID or ObjectID

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

      NODE-3962 Description

      What problem are you facing?

      I'm using https://github.com/vega/ts-json-schema-generator to generate JSON Schema that validates my types. When some object got a property that have an ObjectId type, the generated JSON schema has the rule (besides others):

       
      properties: {
      _bsontype: {
      type: 'string',
      const: 'ObjectID',
      {color:#9abdf5}},
      {color:#89ddff}}

      However an ObjectId instance _bsontype property is equal to ObjectId (lowercase d).

      What driver and relevant dependency versions are you using?

      Node 16.13.2

      BSON 4.6.1

      Steps to reproduce?

      1/ In the source file, check https://github.com/mongodb/js-bson/blob/8305bdf333a4ddec99121b42d9477958342b0fda/src/objectid.ts#L31 : bsontype!: 'ObjectId'

      2/ A node script test.mjs

       

       

      import { ObjectId ] from 'bson';
      console.log((new ObjectId())._bsontype); // echoes ObjectID

       

      My understanding is that it should be either always ObjectId, or always ObjectID.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: