Skip to content

Commit

Permalink
fix(document): allow unsetting boolean field by setting the field to …
Browse files Browse the repository at this point in the history
…`undefined`

Fix #9275
  • Loading branch information
vkarpov15 committed Jul 27, 2020
1 parent 6e362a8 commit 8759703
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/schema/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ SchemaBoolean.prototype._castNullish = function _castNullish(v) {
this.constructor.cast() :
SchemaBoolean.cast();
if (castBoolean == null) {
return null;
return v;
}
if (castBoolean.convertToFalse instanceof Set && castBoolean.convertToFalse.has(v)) {
return false;
}
if (castBoolean.convertToTrue instanceof Set && castBoolean.convertToTrue.has(v)) {
return true;
}
return null;
return v;
};

/*!
Expand Down

0 comments on commit 8759703

Please sign in to comment.