diff --git a/lib/schema.js b/lib/schema.js index c8453fa4307..6464e6c8b52 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -503,7 +503,7 @@ Schema.prototype.defaultOptions = function(options) { */ Schema.prototype.discriminator = function(name, schema) { - this._applyDiscriminators = Object.assign({}, this._applyDiscriminators, { [name]: schema }); + this._applyDiscriminators = Object.assign(this._applyDiscriminators || {}, { [name]: schema }); return this; };