Refactoring day1

This commit is contained in:
2020-08-20 20:27:14 +02:00
parent 6aceefeb2f
commit b907489a75
481 changed files with 5321 additions and 5616 deletions

View File

@@ -175,7 +175,7 @@ SingleNestedPath.prototype.cast = function(val, doc, init, priorVal) {
subdoc.init(val);
} else {
if (Object.keys(val).length === 0) {
return new Constructor({}, selected, doc, undefined, { priorDoc: priorVal });
return new Constructor({}, selected, doc);
}
return new Constructor(val, selected, doc, undefined, { priorDoc: priorVal });
@@ -300,26 +300,6 @@ SingleNestedPath.prototype.discriminator = function(name, schema, value) {
return this.caster.discriminators[name];
};
/**
* Sets a default option for all SingleNestedPath instances.
*
* ####Example:
*
* // Make all numbers have option `min` equal to 0.
* mongoose.Schema.Embedded.set('required', true);
*
* @param {String} option - The option you'd like to set the value for
* @param {*} value - value for option
* @return {undefined}
* @function set
* @static
* @api public
*/
SingleNestedPath.defaultOptions = {};
SingleNestedPath.set = SchemaType.set;
/*!
* ignore
*/