Skip to content

Commit

Permalink
Merge pull request #14431 from Atharv-Bobde/patch-1
Browse files Browse the repository at this point in the history
Added Null check in case schema.options['type'][0] is undefined
  • Loading branch information
vkarpov15 committed Mar 14, 2024
2 parents b94d2fd + 8d0043c commit 1aa88a3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/document.js
Expand Up @@ -1388,6 +1388,7 @@ Document.prototype.$set = function $set(path, val, type, options) {
if (schema.options &&
Array.isArray(schema.options[typeKey]) &&
schema.options[typeKey].length &&
schema.options[typeKey][0] &&
schema.options[typeKey][0].ref &&
_isManuallyPopulatedArray(val, schema.options[typeKey][0].ref)) {
popOpts = { [populateModelSymbol]: val[0].constructor };
Expand Down

0 comments on commit 1aa88a3

Please sign in to comment.