Skip to content

Commit

Permalink
Merge pull request #11265 from Uzlopak/fix-removal-remark
Browse files Browse the repository at this point in the history
remove obsolete code after upgrading to bson4
  • Loading branch information
vkarpov15 committed Jan 24, 2022
2 parents abcdb8e + 94570a6 commit d2497a1
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/cast.js
Expand Up @@ -36,14 +36,6 @@ module.exports = function cast(schema, obj, options, context) {
return obj;
}

// bson 1.x has the unfortunate tendency to remove filters that have a top-level
// `_bsontype` property. But we should still allow ObjectIds because
// `Collection#find()` has a special case to support `find(objectid)`.
// Should remove this when we upgrade to bson 4.x. See gh-8222, gh-8268
if (obj.hasOwnProperty('_bsontype') && obj._bsontype !== 'ObjectID') {
delete obj._bsontype;
}

if (schema != null && schema.discriminators != null && obj[schema.options.discriminatorKey] != null) {
schema = getSchemaDiscriminatorByValue(schema, obj[schema.options.discriminatorKey]) || schema;
}
Expand Down

0 comments on commit d2497a1

Please sign in to comment.