This commit is contained in:
2020-08-20 11:44:32 +02:00
parent 4715fc1814
commit 6aceefeb2f
2891 changed files with 11239 additions and 347539 deletions

View File

@@ -224,6 +224,30 @@ SchemaBoolean.prototype.castForQuery = function($conditional, val) {
return this._castForQuery($conditional);
};
/**
*
* @api private
*/
SchemaBoolean.prototype._castNullish = function _castNullish(v) {
if (typeof v === 'undefined' && this.$$context != null && this.$$context._mongooseOptions.omitUndefined) {
return v;
}
const castBoolean = typeof this.constructor.cast === 'function' ?
this.constructor.cast() :
SchemaBoolean.cast();
if (castBoolean == 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 v;
};
/*!
* Module exports.
*/