Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
bson-1.1.1
-
None
-
None
-
Empty show more show less
Description
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: {}
|