Skip to content

Commit

Permalink
fix: add back fix for #8883 for 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 11, 2021
1 parent 9cde630 commit 0738f36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/schema.js
Expand Up @@ -938,6 +938,11 @@ Schema.prototype.interpretAsType = function(path, obj, options) {
if (options.hasOwnProperty('strict')) {
childSchemaOptions.strict = options.strict;
}
if (this._userProvidedOptions.hasOwnProperty('_id')) {
childSchemaOptions._id = this._userProvidedOptions._id;
} else if (Schema.Types.DocumentArray.defaultOptions._id != null) {
childSchemaOptions._id = Schema.Types.DocumentArray.defaultOptions._id;
}
const childSchema = new Schema(cast, childSchemaOptions);
childSchema.$implicitlyCreated = true;
return new MongooseTypes.DocumentArray(path, childSchema, obj);
Expand Down

0 comments on commit 0738f36

Please sign in to comment.