Skip to content

Commit

Permalink
fix(query): handle strictQuery: 'throw' with nested path correctly
Browse files Browse the repository at this point in the history
Fix #7178
  • Loading branch information
vkarpov15 committed Oct 31, 2018
1 parent 8c16354 commit 22ed5d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cast.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ module.exports = function cast(schema, obj, options, context) {
}
}

if (options.upsert && options.strict && !schema.nested[path]) {
if (schema.nested[path]) {
continue;
}
if (options.upsert && options.strict) {
if (options.strict === 'throw') {
throw new StrictModeError(path);
}
Expand Down

0 comments on commit 22ed5d2

Please sign in to comment.