diff --git a/lib/schematype.js b/lib/schematype.js index 832aa15c4aa..98d5772a5ed 100644 --- a/lib/schematype.js +++ b/lib/schematype.js @@ -462,7 +462,7 @@ SchemaType.prototype.unique = function(bool) { SchemaType.prototype.text = function(bool) { if (this._index === false) { if (!bool) { - return; + return this; } throw new Error('Path "' + this.path + '" may not have `index` set to ' + 'false and `text` set to true'); @@ -499,7 +499,7 @@ SchemaType.prototype.text = function(bool) { SchemaType.prototype.sparse = function(bool) { if (this._index === false) { if (!bool) { - return; + return this; } throw new Error('Path "' + this.path + '" may not have `index` set to ' + 'false and `sparse` set to true');