Skip to content

Commit

Permalink
fix(query): handle embedded discriminator paths on $push
Browse files Browse the repository at this point in the history
Re: #9977
  • Loading branch information
vkarpov15 committed Mar 3, 2021
1 parent d481d19 commit 6c09419
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/helpers/query/castUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ function walkUpdatePath(schema, obj, op, options, context, filter, pref) {
// watch for embedded doc schemas
schematype = schema._getSchema(prefix + key);

if (schematype == null) {
const _res = getEmbeddedDiscriminatorPath(schema, obj, filter, prefix + key);
if (_res.schematype != null) {
schematype = _res.schematype;
}
}

if (op !== '$setOnInsert' &&
handleImmutable(schematype, strict, obj, key, prefix + key, context)) {
continue;
Expand Down

0 comments on commit 6c09419

Please sign in to comment.