From 93f34245839bbbbc88720dd05bc78560cdc73f2b Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Sat, 13 Jun 2020 17:15:31 -0400 Subject: [PATCH] fix: fix tests --- lib/schema.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/schema.js b/lib/schema.js index cc721b074ee..b02ec83109f 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -938,7 +938,8 @@ Schema.prototype.interpretAsType = function(path, obj, options) { } if (this._userProvidedOptions.hasOwnProperty('_id')) { childSchemaOptions._id = this._userProvidedOptions._id; - } else if (Schema.Types.DocumentArray.defaultOptions._id != null) { + } else if (Schema.Types.DocumentArray.defaultOptions && + Schema.Types.DocumentArray.defaultOptions._id != null) { childSchemaOptions._id = Schema.Types.DocumentArray.defaultOptions._id; }