Skip to content

Commit

Permalink
fix(query): correct this scope of setters in update query
Browse files Browse the repository at this point in the history
Fix #7876 re: #4185
`this` inside setters will be a Query when executing an update query.
  • Loading branch information
Fonger committed Jun 8, 2019
1 parent 853d705 commit 9f542d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers/query/castUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function castUpdateVal(schema, val, op, $conditional, context, path) {
++arrayDepth;
}

let tmp = schema.applySetters(Array.isArray(val) ? val : [val]);
let tmp = schema.applySetters(Array.isArray(val) ? val : [val], context);

for (let i = 0; i < additionalNesting; ++i) {
tmp = tmp[0];
Expand Down

0 comments on commit 9f542d1

Please sign in to comment.