Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove obsolete code after upgrading to bson4 #11265

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions lib/cast.js
Original file line number Diff line number Diff line change
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