Skip to content

Commit 1aa88a3

Browse files
authored
Merge pull request #14431 from Atharv-Bobde/patch-1
Added Null check in case schema.options['type'][0] is undefined
2 parents b94d2fd + 8d0043c commit 1aa88a3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/document.js

+1
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,7 @@ Document.prototype.$set = function $set(path, val, type, options) {
13881388
if (schema.options &&
13891389
Array.isArray(schema.options[typeKey]) &&
13901390
schema.options[typeKey].length &&
1391+
schema.options[typeKey][0] &&
13911392
schema.options[typeKey][0].ref &&
13921393
_isManuallyPopulatedArray(val, schema.options[typeKey][0].ref)) {
13931394
popOpts = { [populateModelSymbol]: val[0].constructor };

0 commit comments

Comments
 (0)