diff --git a/lib/schema.js b/lib/schema.js index db45ba78a54..809d80463d7 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -782,7 +782,7 @@ Schema.prototype.path = function(path, obj) { schemaType.schema.subpaths[key].$isUnderneathDocArray = true; } for (const key of Object.keys(schemaType.schema.singleNestedPaths)) { - if (typeof schema.singleNestedPaths[cleanPath] !== 'object') { + if (typeof schemaType.schema.singleNestedPaths[cleanPath] !== 'object') { continue; } this.subpaths[path + '.' + key] = schemaType.schema.singleNestedPaths[key];