@@ -212,16 +212,16 @@ function aliasFields(schema, paths) {
212212
213213 schema .
214214 virtual ( a ) .
215- get ( ( function ( p ) {
216- return function ( ) {
215+ get ( ( function ( p ) {
216+ return function ( ) {
217217 if ( typeof this . get === 'function' ) {
218218 return this . get ( p ) ;
219219 }
220220 return this [ p ] ;
221221 } ;
222222 } ) ( prop ) ) .
223- set ( ( function ( p ) {
224- return function ( v ) {
223+ set ( ( function ( p ) {
224+ return function ( v ) {
225225 return this . $set ( p , v ) ;
226226 } ;
227227 } ) ( prop ) ) ;
@@ -238,16 +238,16 @@ function aliasFields(schema, paths) {
238238
239239 schema .
240240 virtual ( alias ) .
241- get ( ( function ( p ) {
242- return function ( ) {
241+ get ( ( function ( p ) {
242+ return function ( ) {
243243 if ( typeof this . get === 'function' ) {
244244 return this . get ( p ) ;
245245 }
246246 return this [ p ] ;
247247 } ;
248248 } ) ( prop ) ) .
249- set ( ( function ( p ) {
250- return function ( v ) {
249+ set ( ( function ( p ) {
250+ return function ( v ) {
251251 return this . $set ( p , v ) ;
252252 } ;
253253 } ) ( prop ) ) ;
@@ -390,7 +390,7 @@ Schema.prototype.tree;
390390 * @instance
391391 */
392392
393- Schema . prototype . clone = function ( ) {
393+ Schema . prototype . clone = function ( ) {
394394 const s = this . _clone ( ) ;
395395
396396 // Bubble up `init` for backwards compat
@@ -410,7 +410,7 @@ Schema.prototype._clone = function _clone(Constructor) {
410410 s . base = this . base ;
411411 s . obj = this . obj ;
412412 s . options = clone ( this . options ) ;
413- s . callQueue = this . callQueue . map ( function ( f ) { return f ; } ) ;
413+ s . callQueue = this . callQueue . map ( function ( f ) { return f ; } ) ;
414414 s . methods = clone ( this . methods ) ;
415415 s . methodOptions = clone ( this . methodOptions ) ;
416416 s . statics = clone ( this . statics ) ;
@@ -493,7 +493,7 @@ Schema.prototype._clone = function _clone(Constructor) {
493493 * @api public
494494 */
495495
496- Schema . prototype . pick = function ( paths , options ) {
496+ Schema . prototype . pick = function ( paths , options ) {
497497 const newSchema = new Schema ( { } , options || this . options ) ;
498498 if ( ! Array . isArray ( paths ) ) {
499499 throw new MongooseError ( 'Schema#pick() only accepts an array argument, ' +
@@ -549,7 +549,7 @@ Schema.prototype.pick = function (paths, options) {
549549 * @api public
550550 */
551551
552- Schema . prototype . omit = function ( paths , options ) {
552+ Schema . prototype . omit = function ( paths , options ) {
553553 const newSchema = new Schema ( this , options || this . options ) ;
554554 if ( ! Array . isArray ( paths ) ) {
555555 throw new MongooseError (
@@ -579,7 +579,7 @@ Schema.prototype.omit = function (paths, options) {
579579 * @api private
580580 */
581581
582- Schema . prototype . defaultOptions = function ( options ) {
582+ Schema . prototype . defaultOptions = function ( options ) {
583583 this . _userProvidedOptions = options == null ? { } : clone ( options ) ;
584584 const baseOptions = this . base && this . base . options || { } ;
585585 const strict = 'strict' in baseOptions ? baseOptions . strict : true ;
@@ -656,7 +656,7 @@ Schema.prototype.defaultOptions = function (options) {
656656 * @return {Schema } the Schema instance
657657 * @api public
658658 */
659- Schema . prototype . discriminator = function ( name , schema , options ) {
659+ Schema . prototype . discriminator = function ( name , schema , options ) {
660660 this . _applyDiscriminators = this . _applyDiscriminators || new Map ( ) ;
661661 this . _applyDiscriminators . set ( name , { schema, options } ) ;
662662
@@ -668,7 +668,7 @@ Schema.prototype.discriminator = function (name, schema, options) {
668668 * options.
669669 */
670670
671- Schema . prototype . _defaultToObjectOptions = function ( json ) {
671+ Schema . prototype . _defaultToObjectOptions = function ( json ) {
672672 const path = json ? 'toJSON' : 'toObject' ;
673673 if ( this . _defaultToObjectOptionsMap && this . _defaultToObjectOptionsMap [ path ] ) {
674674 return this . _defaultToObjectOptionsMap [ path ] ;
@@ -891,7 +891,7 @@ Schema.prototype.add = function add(obj, prefix) {
891891/**
892892 * @param {string } path
893893 * @param {object } fieldConfig
894- *
894+ *
895895 * @api private
896896 */
897897Schema . prototype . _addEncryptedField = function _addEncryptedField ( path , fieldConfig ) {
@@ -1133,7 +1133,7 @@ reserved.collection = 1;
11331133 * @api public
11341134 */
11351135
1136- Schema . prototype . path = function ( path , obj ) {
1136+ Schema . prototype . path = function ( path , obj ) {
11371137 if ( obj === undefined ) {
11381138 if ( this . paths [ path ] != null ) {
11391139 return this . paths [ path ] ;
@@ -1434,7 +1434,7 @@ Object.defineProperty(Schema.prototype, 'base', {
14341434 * @api private
14351435 */
14361436
1437- Schema . prototype . interpretAsType = function ( path , obj , options ) {
1437+ Schema . prototype . interpretAsType = function ( path , obj , options ) {
14381438 if ( obj instanceof SchemaType ) {
14391439 if ( obj . path === path ) {
14401440 return obj ;
@@ -1709,7 +1709,7 @@ function createMapNestedSchemaType(schema, schemaType, path, obj, options) {
17091709 * @api public
17101710 */
17111711
1712- Schema . prototype . eachPath = function ( fn ) {
1712+ Schema . prototype . eachPath = function ( fn ) {
17131713 const keys = Object . keys ( this . paths ) ;
17141714 const len = keys . length ;
17151715
@@ -1790,7 +1790,7 @@ Schema.prototype.indexedPaths = function indexedPaths() {
17901790 * @api public
17911791 */
17921792
1793- Schema . prototype . pathType = function ( path ) {
1793+ Schema . prototype . pathType = function ( path ) {
17941794 if ( this . paths . hasOwnProperty ( path ) ) {
17951795 return 'real' ;
17961796 }
@@ -1833,7 +1833,7 @@ Schema.prototype.pathType = function (path) {
18331833 * @api private
18341834 */
18351835
1836- Schema . prototype . hasMixedParent = function ( path ) {
1836+ Schema . prototype . hasMixedParent = function ( path ) {
18371837 const subpaths = path . split ( / \. / g) ;
18381838 path = '' ;
18391839 for ( let i = 0 ; i < subpaths . length ; ++ i ) {
@@ -1853,7 +1853,7 @@ Schema.prototype.hasMixedParent = function (path) {
18531853 * @param {Boolean|Object } timestamps timestamps options
18541854 * @api private
18551855 */
1856- Schema . prototype . setupTimestamp = function ( timestamps ) {
1856+ Schema . prototype . setupTimestamp = function ( timestamps ) {
18571857 return setupTimestamps ( this , timestamps ) ;
18581858} ;
18591859
@@ -1951,7 +1951,7 @@ function getPositionalPath(self, path, cleanPath) {
19511951 * @api public
19521952 */
19531953
1954- Schema . prototype . queue = function ( name , args ) {
1954+ Schema . prototype . queue = function ( name , args ) {
19551955 this . callQueue . push ( [ name , args ] ) ;
19561956 return this ;
19571957} ;
@@ -1999,7 +1999,7 @@ Schema.prototype.queue = function (name, args) {
19991999 * @api public
20002000 */
20012001
2002- Schema . prototype . pre = function ( name ) {
2002+ Schema . prototype . pre = function ( name ) {
20032003 if ( name instanceof RegExp ) {
20042004 const remainingArgs = Array . prototype . slice . call ( arguments , 1 ) ;
20052005 for ( const fn of hookNames ) {
@@ -2057,7 +2057,7 @@ Schema.prototype.pre = function (name) {
20572057 * @api public
20582058 */
20592059
2060- Schema . prototype . post = function ( name ) {
2060+ Schema . prototype . post = function ( name ) {
20612061 if ( name instanceof RegExp ) {
20622062 const remainingArgs = Array . prototype . slice . call ( arguments , 1 ) ;
20632063 for ( const fn of hookNames ) {
@@ -2100,7 +2100,7 @@ Schema.prototype.post = function (name) {
21002100 * @api public
21012101 */
21022102
2103- Schema . prototype . plugin = function ( fn , opts ) {
2103+ Schema . prototype . plugin = function ( fn , opts ) {
21042104 if ( typeof fn !== 'function' ) {
21052105 throw new Error ( 'First param to `schema.plugin()` must be a function, ' +
21062106 'got "' + ( typeof fn ) + '"' ) ;
@@ -2155,7 +2155,7 @@ Schema.prototype.plugin = function (fn, opts) {
21552155 * @api public
21562156 */
21572157
2158- Schema . prototype . method = function ( name , fn , options ) {
2158+ Schema . prototype . method = function ( name , fn , options ) {
21592159 if ( typeof name !== 'string' ) {
21602160 for ( const i in name ) {
21612161 this . methods [ i ] = name [ i ] ;
@@ -2201,7 +2201,7 @@ Schema.prototype.method = function (name, fn, options) {
22012201 * @see Statics https://mongoosejs.com/docs/guide.html#statics
22022202 */
22032203
2204- Schema . prototype . static = function ( name , fn ) {
2204+ Schema . prototype . static = function ( name , fn ) {
22052205 if ( typeof name !== 'string' ) {
22062206 for ( const i in name ) {
22072207 this . statics [ i ] = name [ i ] ;
@@ -2226,7 +2226,7 @@ Schema.prototype.static = function (name, fn) {
22262226 * @api public
22272227 */
22282228
2229- Schema . prototype . index = function ( fields , options ) {
2229+ Schema . prototype . index = function ( fields , options ) {
22302230 fields || ( fields = { } ) ;
22312231 options || ( options = { } ) ;
22322232
@@ -2272,7 +2272,7 @@ Schema.prototype.index = function (fields, options) {
22722272 * @api public
22732273 */
22742274
2275- Schema . prototype . set = function ( key , value , tags ) {
2275+ Schema . prototype . set = function ( key , value , tags ) {
22762276 if ( arguments . length === 1 ) {
22772277 return this . options [ key ] ;
22782278 }
@@ -2363,7 +2363,7 @@ function _propagateOptionsToImplicitlyCreatedSchemas(baseSchema, options) {
23632363 * @return {Any } the option's value
23642364 */
23652365
2366- Schema . prototype . get = function ( key ) {
2366+ Schema . prototype . get = function ( key ) {
23672367 return this . options [ key ] ;
23682368} ;
23692369
@@ -2379,10 +2379,10 @@ const indexTypes = '2d 2dsphere hashed text'.split(' ');
23792379 */
23802380
23812381Object . defineProperty ( Schema , 'indexTypes' , {
2382- get : function ( ) {
2382+ get : function ( ) {
23832383 return indexTypes ;
23842384 } ,
2385- set : function ( ) {
2385+ set : function ( ) {
23862386 throw new Error ( 'Cannot overwrite Schema.indexTypes' ) ;
23872387 }
23882388} ) ;
@@ -2417,7 +2417,7 @@ Object.defineProperty(Schema, 'indexTypes', {
24172417 * @return {Array } list of indexes defined in the schema
24182418 */
24192419
2420- Schema . prototype . indexes = function ( ) {
2420+ Schema . prototype . indexes = function ( ) {
24212421 return getIndexes ( this ) ;
24222422} ;
24232423
@@ -2437,7 +2437,7 @@ Schema.prototype.indexes = function () {
24372437 * @return {VirtualType }
24382438 */
24392439
2440- Schema . prototype . virtual = function ( name , options ) {
2440+ Schema . prototype . virtual = function ( name , options ) {
24412441 if ( name instanceof VirtualType || getConstructorName ( name ) === 'VirtualType' ) {
24422442 return this . virtual ( name . path , name . options ) ;
24432443 }
@@ -2493,7 +2493,7 @@ Schema.prototype.virtual = function (name, options) {
24932493 } ) ;
24942494
24952495 virtual .
2496- set ( function ( v ) {
2496+ set ( function ( v ) {
24972497 if ( ! this . $$populatedVirtuals ) {
24982498 this . $$populatedVirtuals = { } ;
24992499 }
@@ -2539,7 +2539,7 @@ Schema.prototype.virtual = function (name, options) {
25392539 ' conflicts with a real path in the schema' ) ;
25402540 }
25412541
2542- virtuals [ name ] = parts . reduce ( function ( mem , part , i ) {
2542+ virtuals [ name ] = parts . reduce ( function ( mem , part , i ) {
25432543 mem [ part ] || ( mem [ part ] = ( i === parts . length - 1 )
25442544 ? new VirtualType ( options , name )
25452545 : { } ) ;
@@ -2565,7 +2565,7 @@ Schema.prototype.virtual = function (name, options) {
25652565 * @return {VirtualType|null }
25662566 */
25672567
2568- Schema . prototype . virtualpath = function ( name ) {
2568+ Schema . prototype . virtualpath = function ( name ) {
25692569 return this . virtuals . hasOwnProperty ( name ) ? this . virtuals [ name ] : null ;
25702570} ;
25712571
@@ -2589,12 +2589,12 @@ Schema.prototype.virtualpath = function (name) {
25892589 * @return {Schema } the Schema instance
25902590 * @api public
25912591 */
2592- Schema . prototype . remove = function ( path ) {
2592+ Schema . prototype . remove = function ( path ) {
25932593 if ( typeof path === 'string' ) {
25942594 path = [ path ] ;
25952595 }
25962596 if ( Array . isArray ( path ) ) {
2597- path . forEach ( function ( name ) {
2597+ path . forEach ( function ( name ) {
25982598 if ( this . path ( name ) == null && ! this . nested [ name ] ) {
25992599 return ;
26002600 }
@@ -2648,7 +2648,7 @@ function _deletePath(schema, name) {
26482648 * @api public
26492649 */
26502650
2651- Schema . prototype . removeVirtual = function ( path ) {
2651+ Schema . prototype . removeVirtual = function ( path ) {
26522652 if ( typeof path === 'string' ) {
26532653 path = [ path ] ;
26542654 }
@@ -2710,7 +2710,7 @@ Schema.prototype.removeVirtual = function (path) {
27102710 * @param {Function } model The Class to load
27112711 * @param {Boolean } [virtualsOnly] if truthy, only pulls virtuals from the class, not methods or statics
27122712 */
2713- Schema . prototype . loadClass = function ( model , virtualsOnly ) {
2713+ Schema . prototype . loadClass = function ( model , virtualsOnly ) {
27142714 // Stop copying when hit certain base classes
27152715 if ( model === Object . prototype ||
27162716 model === Function . prototype ||
@@ -2723,7 +2723,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) {
27232723
27242724 // Add static methods
27252725 if ( ! virtualsOnly ) {
2726- Object . getOwnPropertyNames ( model ) . forEach ( function ( name ) {
2726+ Object . getOwnPropertyNames ( model ) . forEach ( function ( name ) {
27272727 if ( name . match ( / ^ ( l e n g t h | n a m e | p r o t o t y p e | c o n s t r u c t o r | _ _ p r o t o _ _ ) $ / ) ) {
27282728 return ;
27292729 }
@@ -2735,7 +2735,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) {
27352735 }
27362736
27372737 // Add methods and virtuals
2738- Object . getOwnPropertyNames ( model . prototype ) . forEach ( function ( name ) {
2738+ Object . getOwnPropertyNames ( model . prototype ) . forEach ( function ( name ) {
27392739 if ( name . match ( / ^ ( c o n s t r u c t o r ) $ / ) ) {
27402740 return ;
27412741 }
@@ -2766,7 +2766,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) {
27662766 * ignore
27672767 */
27682768
2769- Schema . prototype . _getSchema = function ( path ) {
2769+ Schema . prototype . _getSchema = function ( path ) {
27702770 const _this = this ;
27712771 const pathschema = _this . path ( path ) ;
27722772 const resultPath = [ ] ;
@@ -2873,7 +2873,7 @@ Schema.prototype._getSchema = function (path) {
28732873 * ignore
28742874 */
28752875
2876- Schema . prototype . _getPathType = function ( path ) {
2876+ Schema . prototype . _getPathType = function ( path ) {
28772877 const _this = this ;
28782878 const pathschema = _this . path ( path ) ;
28792879
@@ -2883,8 +2883,8 @@ Schema.prototype._getPathType = function (path) {
28832883
28842884 function search ( parts , schema ) {
28852885 let p = parts . length + 1 ,
2886- foundschema ,
2887- trypath ;
2886+ foundschema ,
2887+ trypath ;
28882888
28892889 while ( p -- ) {
28902890 trypath = parts . slice ( 0 , p ) . join ( '.' ) ;
0 commit comments