-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: bson-1.1.1
-
Component/s: None
-
None
-
Empty show more show less
1.x versions of js-bson will silently ignore an unknown value for an object's _bsontype, leading to cases where an object is serialized as a document rather than the intended BSON type.
For example:
const bson = require('bson'); const BSON = new bson(); const oid = new bson.ObjectId(); oid._bsontype = "invalid"; console.dir(BSON.deserialize(BSON.serialize({ a: oid })); // results in: {}