-
Type:
Bug
-
Resolution: Done
-
Priority:
Unknown
-
None
-
Affects Version/s: bson-4.6.1
-
Component/s: BSON
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.