Skip to content

Commit

Permalink
fix: apply setters in castForQuery with uuid
Browse files Browse the repository at this point in the history
Re: #14114
  • Loading branch information
vkarpov15 committed Dec 14, 2023
1 parent 86df50c commit 4847721
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/schema/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,15 @@ SchemaUUID.prototype.castForQuery = function($conditional, val, context) {
if (!handler)
throw new Error('Can\'t use ' + $conditional + ' with UUID.');
return handler.call(this, val, context);
} else {
return this.cast(val);
}

try {
return this.applySetters(val, context);
} catch (err) {
if (err instanceof CastError && err.path === this.path && this.$fullPath != null) {
err.path = this.$fullPath;
}
throw err;
}
};

Expand Down

0 comments on commit 4847721

Please sign in to comment.