mongoose 9.2.2 → 9.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/lib/aggregate.js +41 -41
  2. package/lib/cast/bigint.js +2 -2
  3. package/lib/cast/boolean.js +3 -3
  4. package/lib/cast/double.js +2 -2
  5. package/lib/cast/int32.js +2 -2
  6. package/lib/cast/number.js +2 -2
  7. package/lib/cast/string.js +2 -2
  8. package/lib/cast.js +6 -6
  9. package/lib/collection.js +4 -4
  10. package/lib/connection.js +58 -58
  11. package/lib/cursor/aggregationCursor.js +6 -6
  12. package/lib/cursor/queryCursor.js +7 -7
  13. package/lib/document.js +176 -176
  14. package/lib/drivers/node-mongodb-native/collection.js +2 -2
  15. package/lib/drivers/node-mongodb-native/connection.js +8 -8
  16. package/lib/error/cast.js +2 -2
  17. package/lib/error/createCollectionsError.js +2 -2
  18. package/lib/error/divergentArray.js +1 -1
  19. package/lib/error/eachAsyncMultiError.js +1 -1
  20. package/lib/error/index.js +2 -2
  21. package/lib/error/invalidSchemaOption.js +1 -1
  22. package/lib/error/missingSchema.js +1 -1
  23. package/lib/error/objectParameter.js +3 -3
  24. package/lib/error/overwriteModel.js +1 -1
  25. package/lib/error/setOptionError.js +3 -3
  26. package/lib/error/strict.js +3 -3
  27. package/lib/error/strictPopulate.js +2 -2
  28. package/lib/error/syncIndexes.js +2 -2
  29. package/lib/error/validation.js +2 -2
  30. package/lib/error/validator.js +1 -1
  31. package/lib/error/version.js +2 -2
  32. package/lib/helpers/buildMiddlewareFilter.js +2 -2
  33. package/lib/helpers/clone.js +4 -4
  34. package/lib/helpers/createJSONSchemaTypeDefinition.js +4 -4
  35. package/lib/helpers/cursor/eachAsync.js +3 -3
  36. package/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
  37. package/lib/helpers/discriminator/mergeDiscriminatorSchema.js +3 -3
  38. package/lib/helpers/document/applyTimestamps.js +9 -9
  39. package/lib/helpers/document/applyVirtuals.js +6 -6
  40. package/lib/helpers/document/compile.js +10 -10
  41. package/lib/helpers/document/getDeepestSubdocumentForPath.js +2 -2
  42. package/lib/helpers/document/getEmbeddedDiscriminatorPath.js +2 -2
  43. package/lib/helpers/indexes/isIndexEqual.js +3 -3
  44. package/lib/helpers/indexes/isIndexSpecEqual.js +3 -3
  45. package/lib/helpers/isMongooseObject.js +1 -1
  46. package/lib/helpers/isObject.js +2 -2
  47. package/lib/helpers/isSimpleValidator.js +2 -2
  48. package/lib/helpers/minimize.js +2 -2
  49. package/lib/helpers/model/applyHooks.js +1 -1
  50. package/lib/helpers/model/castBulkWrite.js +2 -2
  51. package/lib/helpers/pluralize.js +1 -1
  52. package/lib/helpers/populate/assignRawDocsToIdStructure.js +2 -2
  53. package/lib/helpers/populate/assignVals.js +6 -6
  54. package/lib/helpers/populate/createPopulateQueryFilter.js +2 -2
  55. package/lib/helpers/populate/getModelsMapForPopulate.js +12 -12
  56. package/lib/helpers/populate/getSchemaTypes.js +1 -1
  57. package/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  58. package/lib/helpers/populate/setPopulatedVirtualValue.js +5 -5
  59. package/lib/helpers/projection/hasIncludedChildren.js +1 -1
  60. package/lib/helpers/projection/isPathExcluded.js +3 -3
  61. package/lib/helpers/projection/isSubpath.js +1 -1
  62. package/lib/helpers/query/castUpdate.js +14 -14
  63. package/lib/helpers/query/getEmbeddedDiscriminatorPath.js +4 -4
  64. package/lib/helpers/query/handleImmutable.js +6 -6
  65. package/lib/helpers/schema/getIndexes.js +1 -1
  66. package/lib/helpers/schema/getSubdocumentStrictValue.js +1 -1
  67. package/lib/helpers/setDefaultsOnInsert.js +3 -3
  68. package/lib/helpers/update/modifiedPaths.js +2 -2
  69. package/lib/helpers/updateValidators.js +2 -2
  70. package/lib/model.js +263 -263
  71. package/lib/mongoose.js +54 -54
  72. package/lib/options/schemaArrayOptions.js +2 -2
  73. package/lib/options/schemaBufferOptions.js +1 -1
  74. package/lib/options/schemaNumberOptions.js +3 -3
  75. package/lib/options/schemaObjectIdOptions.js +2 -2
  76. package/lib/options/schemaStringOptions.js +6 -6
  77. package/lib/options/schemaTypeOptions.js +13 -13
  78. package/lib/options/virtualOptions.js +11 -11
  79. package/lib/query.js +222 -222
  80. package/lib/queryHelpers.js +4 -4
  81. package/lib/schema/array.js +18 -18
  82. package/lib/schema/bigint.js +13 -13
  83. package/lib/schema/boolean.js +13 -13
  84. package/lib/schema/buffer.js +14 -14
  85. package/lib/schema/date.js +16 -16
  86. package/lib/schema/decimal128.js +13 -13
  87. package/lib/schema/documentArray.js +15 -15
  88. package/lib/schema/documentArrayElement.js +5 -6
  89. package/lib/schema/double.js +12 -12
  90. package/lib/schema/int32.js +13 -13
  91. package/lib/schema/map.js +10 -10
  92. package/lib/schema/mixed.js +10 -10
  93. package/lib/schema/number.js +18 -18
  94. package/lib/schema/objectId.js +14 -14
  95. package/lib/schema/operators/text.js +3 -3
  96. package/lib/schema/string.js +17 -17
  97. package/lib/schema/subdocument.js +13 -13
  98. package/lib/schema/union.js +3 -3
  99. package/lib/schema/uuid.js +16 -16
  100. package/lib/schema.js +76 -76
  101. package/lib/schemaType.js +62 -62
  102. package/lib/stateMachine.js +5 -8
  103. package/lib/types/array/index.js +1 -1
  104. package/lib/types/array/methods/index.js +12 -12
  105. package/lib/types/arraySubdocument.js +8 -8
  106. package/lib/types/buffer.js +4 -4
  107. package/lib/types/documentArray/index.js +1 -1
  108. package/lib/types/documentArray/methods/index.js +5 -5
  109. package/lib/types/map.js +3 -3
  110. package/lib/types/subdocument.js +11 -11
  111. package/lib/utils.js +45 -45
  112. package/lib/virtualType.js +18 -18
  113. package/package.json +8 -5
  114. package/types/index.d.ts +16 -15
  115. package/types/inferschematype.d.ts +10 -0
  116. package/types/models.d.ts +8 -5
  117. package/types/schemaoptions.d.ts +1 -1
  118. package/types/virtuals.d.ts +10 -10
@@ -82,7 +82,7 @@ NativeCollection.prototype._getCollection = function _getCollection() {
82
82
 
83
83
  /**
84
84
  * Copy the collection methods and make them subject to queues
85
- * @param {Number|String} I
85
+ * @param {number|string} I
86
86
  * @api private
87
87
  */
88
88
 
@@ -278,7 +278,7 @@ NativeCollection.prototype.$format = function(arg, color, shell) {
278
278
 
279
279
  /**
280
280
  * Debug print helper
281
- * @param {Any} representation
281
+ * @param {any} representation
282
282
  * @api private
283
283
  */
284
284
 
@@ -52,9 +52,9 @@ Object.setPrototypeOf(NativeConnection.prototype, MongooseConnection.prototype);
52
52
  *
53
53
  * **Note:** Calling `close()` on a `useDb()` connection will close the base connection as well.
54
54
  *
55
- * @param {String} name The database name
56
- * @param {Object} [options]
57
- * @param {Boolean} [options.useCache=false] If true, cache results so calling `useDb()` multiple times with the same name only creates 1 connection object.
55
+ * @param {string} name The database name
56
+ * @param {object} [options]
57
+ * @param {boolean} [options.useCache=false] If true, cache results so calling `useDb()` multiple times with the same name only creates 1 connection object.
58
58
  * @return {Connection} New Connection Object
59
59
  * @api public
60
60
  */
@@ -130,7 +130,7 @@ NativeConnection.prototype.useDb = function(name, options) {
130
130
  * Runs a [db-level aggregate()](https://www.mongodb.com/docs/manual/reference/method/db.aggregate/) on this connection's underlying `db`
131
131
  *
132
132
  * @param {Array} pipeline
133
- * @param {Object} [options]
133
+ * @param {object} [options]
134
134
  */
135
135
 
136
136
  NativeConnection.prototype.aggregate = function aggregate(pipeline, options) {
@@ -155,7 +155,7 @@ NativeConnection.prototype.aggregate = function aggregate(pipeline, options) {
155
155
  *
156
156
  * @method removeDb
157
157
  * @memberOf Connection
158
- * @param {String} name The database name
158
+ * @param {string} name The database name
159
159
  * @return {Connection} this
160
160
  */
161
161
 
@@ -178,7 +178,7 @@ NativeConnection.prototype.removeDb = function removeDb(name) {
178
178
  /**
179
179
  * Closes the connection
180
180
  *
181
- * @param {Boolean} [force]
181
+ * @param {boolean} [force]
182
182
  * @return {Connection} this
183
183
  * @api private
184
184
  */
@@ -211,7 +211,7 @@ NativeConnection.prototype.doClose = async function doClose(force) {
211
211
  /**
212
212
  * Implementation of `listDatabases()` for MongoDB driver
213
213
  *
214
- * @return Promise
214
+ * @return {Promise}
215
215
  * @api public
216
216
  */
217
217
 
@@ -354,7 +354,7 @@ NativeConnection.prototype.createClient = async function createClient(uri, optio
354
354
  * a schemaMap and/or an encryptedFieldsMap for the connection, combining all models
355
355
  * into a single schemaMap and encryptedFields map.
356
356
  *
357
- * @returns the generated schemaMap and encryptedFieldsMap
357
+ * @returns {object} the generated schemaMap and encryptedFieldsMap
358
358
  */
359
359
  NativeConnection.prototype._buildEncryptionSchemas = function() {
360
360
  const qeMappings = {};
package/lib/error/cast.js CHANGED
@@ -10,8 +10,8 @@ const util = require('util');
10
10
  /**
11
11
  * Casting Error constructor.
12
12
  *
13
- * @param {String} type
14
- * @param {String} value
13
+ * @param {string} type
14
+ * @param {string} value
15
15
  * @inherits MongooseError
16
16
  * @api private
17
17
  */
@@ -5,8 +5,8 @@ const MongooseError = require('./mongooseError');
5
5
  /**
6
6
  * createCollections Error constructor
7
7
  *
8
- * @param {String} message
9
- * @param {String} errorsMap
8
+ * @param {string} message
9
+ * @param {string} errorsMap
10
10
  * @inherits MongooseError
11
11
  * @api private
12
12
  */
@@ -9,7 +9,7 @@ const MongooseError = require('./mongooseError');
9
9
 
10
10
  /**
11
11
  * DivergentArrayError constructor.
12
- * @param {Array<String>} paths
12
+ * @param {string[]} paths
13
13
  * @api private
14
14
  */
15
15
 
@@ -17,7 +17,7 @@ const MongooseError = require('./mongooseError');
17
17
 
18
18
  class EachAsyncMultiError extends MongooseError {
19
19
  /**
20
- * @param {String} connectionString
20
+ * @param {string} connectionString
21
21
  */
22
22
  constructor(errors) {
23
23
  let preview = errors.map(e => e.message).join(', ');
@@ -13,7 +13,7 @@
13
13
  * err instanceof mongoose.Error.ValidationError; // true
14
14
  *
15
15
  * @constructor Error
16
- * @param {String} msg Error message
16
+ * @param {string} msg Error message
17
17
  * @inherits Error https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error
18
18
  */
19
19
 
@@ -39,7 +39,7 @@ const MongooseError = require('./mongooseError');
39
39
  * - `VersionError`: Thrown when the [document is out of sync](https://mongoosejs.com/docs/guide.html#versionKey)
40
40
  *
41
41
  * @api public
42
- * @property {String} name
42
+ * @property {string} name
43
43
  * @memberOf Error
44
44
  * @instance
45
45
  */
@@ -9,7 +9,7 @@ const MongooseError = require('./mongooseError');
9
9
 
10
10
  /**
11
11
  * InvalidSchemaOption Error constructor.
12
- * @param {String} name
12
+ * @param {string} name
13
13
  * @api private
14
14
  */
15
15
 
@@ -9,7 +9,7 @@ const MongooseError = require('./mongooseError');
9
9
 
10
10
  /**
11
11
  * MissingSchema Error constructor.
12
- * @param {String} name
12
+ * @param {string} name
13
13
  * @api private
14
14
  */
15
15
 
@@ -10,9 +10,9 @@ const MongooseError = require('./mongooseError');
10
10
  * Constructor for errors that happen when a parameter that's expected to be
11
11
  * an object isn't an object
12
12
  *
13
- * @param {Any} value
14
- * @param {String} paramName
15
- * @param {String} fnName
13
+ * @param {any} value
14
+ * @param {string} paramName
15
+ * @param {string} fnName
16
16
  * @api private
17
17
  */
18
18
 
@@ -9,7 +9,7 @@ const MongooseError = require('./mongooseError');
9
9
 
10
10
  /**
11
11
  * OverwriteModel Error constructor.
12
- * @param {String} name
12
+ * @param {string} name
13
13
  * @api private
14
14
  */
15
15
 
@@ -40,8 +40,8 @@ class SetOptionError extends MongooseError {
40
40
 
41
41
  /**
42
42
  * add message
43
- * @param {String} key
44
- * @param {String|Error} error
43
+ * @param {string} key
44
+ * @param {string|Error} error
45
45
  * @api private
46
46
  */
47
47
  addError(key, error) {
@@ -87,7 +87,7 @@ Object.defineProperty(SetOptionError.prototype, 'name', {
87
87
  class SetOptionInnerError extends MongooseError {
88
88
  /**
89
89
  * Error for the "errors" array in "SetOptionError" with consistent message
90
- * @param {String} key
90
+ * @param {string} key
91
91
  */
92
92
  constructor(key) {
93
93
  super(`"${key}" is not a valid option to set`);
@@ -9,9 +9,9 @@ const MongooseError = require('./mongooseError');
9
9
  /**
10
10
  * Strict mode error constructor
11
11
  *
12
- * @param {String} path
13
- * @param {String} [msg]
14
- * @param {Boolean} [immutable]
12
+ * @param {string} path
13
+ * @param {string} [msg]
14
+ * @param {boolean} [immutable]
15
15
  * @inherits MongooseError
16
16
  * @api private
17
17
  */
@@ -9,8 +9,8 @@ const MongooseError = require('./mongooseError');
9
9
  /**
10
10
  * Strict mode error constructor
11
11
  *
12
- * @param {String} path
13
- * @param {String} [msg]
12
+ * @param {string} path
13
+ * @param {string} [msg]
14
14
  * @inherits MongooseError
15
15
  * @api private
16
16
  */
@@ -9,8 +9,8 @@ const MongooseError = require('./mongooseError');
9
9
  /**
10
10
  * SyncIndexes Error constructor.
11
11
  *
12
- * @param {String} message
13
- * @param {String} errorsMap
12
+ * @param {string} message
13
+ * @param {string} errorsMap
14
14
  * @inherits MongooseError
15
15
  * @api private
16
16
  */
@@ -46,8 +46,8 @@ class ValidationError extends MongooseError {
46
46
 
47
47
  /**
48
48
  * add message
49
- * @param {String} path
50
- * @param {String|Error} error
49
+ * @param {string} path
50
+ * @param {string|Error} error
51
51
  * @api private
52
52
  */
53
53
  addError(path, error) {
@@ -9,7 +9,7 @@ const MongooseError = require('./mongooseError');
9
9
  /**
10
10
  * Schema validator error
11
11
  *
12
- * @param {Object} properties
12
+ * @param {object} properties
13
13
  * @param {Document} doc
14
14
  * @api private
15
15
  */
@@ -10,8 +10,8 @@ const MongooseError = require('./mongooseError');
10
10
  * Version Error constructor.
11
11
  *
12
12
  * @param {Document} doc
13
- * @param {Number} currentVersion
14
- * @param {Array<String>} modifiedPaths
13
+ * @param {number} currentVersion
14
+ * @param {string[]} modifiedPaths
15
15
  * @api private
16
16
  */
17
17
 
@@ -10,8 +10,8 @@ const isBuiltInMiddleware = hook => hook.fn[symbols.builtInMiddleware];
10
10
  /**
11
11
  * Builds a filter for kareem's execPre/execPost based on middleware options.
12
12
  *
13
- * @param {Object} options - Options object that may contain `middleware` setting
14
- * @param {String} phase - Either 'pre' or 'post'
13
+ * @param {object} options - Options object that may contain `middleware` setting
14
+ * @param {string} phase - Either 'pre' or 'post'
15
15
  * @returns {Function|null} - null runs all middleware, isBuiltInMiddleware skips user middleware
16
16
  */
17
17
  function buildMiddlewareFilter(options, phase) {
@@ -23,10 +23,10 @@ const Binary = BSON.Binary;
23
23
  *
24
24
  * Functions and primitives are never cloned.
25
25
  *
26
- * @param {Object} obj the object to clone
27
- * @param {Object} options
28
- * @param {Boolean} isArrayChild true if cloning immediately underneath an array. Special case for minimize.
29
- * @return {Object} the cloned object
26
+ * @param {object} obj the object to clone
27
+ * @param {object} options
28
+ * @param {boolean} isArrayChild true if cloning immediately underneath an array. Special case for minimize.
29
+ * @return {object} the cloned object
30
30
  * @api private
31
31
  */
32
32
 
@@ -3,10 +3,10 @@
3
3
  /**
4
4
  * Handles creating `{ type: 'object' }` vs `{ bsonType: 'object' }` vs `{ bsonType: ['object', 'null'] }`
5
5
  *
6
- * @param {String} type
7
- * @param {String} bsonType
8
- * @param {Boolean} useBsonType
9
- * @param {Boolean} isRequired
6
+ * @param {string} type
7
+ * @param {string} bsonType
8
+ * @param {boolean} useBsonType
9
+ * @param {boolean} isRequired
10
10
  */
11
11
 
12
12
  module.exports = function createJSONSchemaTypeArray(type, bsonType, useBsonType, isRequired) {
@@ -14,9 +14,9 @@ const immediate = require('../immediate');
14
14
  *
15
15
  * @param {Function} next the thunk to call to get the next document
16
16
  * @param {Function} fn
17
- * @param {Object} options
18
- * @param {Number} [options.batchSize=null] if set, Mongoose will call `fn` with an array of at most `batchSize` documents, instead of a single document
19
- * @param {Number} [options.parallel=1] maximum number of `fn` calls that Mongoose will run in parallel
17
+ * @param {object} options
18
+ * @param {number} [options.batchSize=null] if set, Mongoose will call `fn` with an array of at most `batchSize` documents, instead of a single document
19
+ * @param {number} [options.parallel=1] maximum number of `fn` calls that Mongoose will run in parallel
20
20
  * @param {AbortSignal} [options.signal] allow cancelling this eachAsync(). Once the abort signal is fired, `eachAsync()` will immediately fulfill the returned promise (or call the callback) and not fetch any more documents.
21
21
  * @return {Promise}
22
22
  * @api public
@@ -5,7 +5,7 @@ const areDiscriminatorValuesEqual = require('./areDiscriminatorValuesEqual');
5
5
  /**
6
6
  * returns discriminator by discriminatorMapping.value
7
7
  *
8
- * @param {Object} discriminators
8
+ * @param {object} discriminators
9
9
  * @param {string} value
10
10
  * @api private
11
11
  */
@@ -8,9 +8,9 @@ const isObject = require('../../helpers/isObject');
8
8
  /**
9
9
  * Merges `from` into `to` without overwriting existing properties.
10
10
  *
11
- * @param {Object} to
12
- * @param {Object} from
13
- * @param {String} [path]
11
+ * @param {object} to
12
+ * @param {object} from
13
+ * @param {string} [path]
14
14
  * @api private
15
15
  */
16
16
 
@@ -10,9 +10,9 @@ module.exports = applyTimestamps;
10
10
  * Apply a given schema's timestamps to the given POJO
11
11
  *
12
12
  * @param {Schema} schema
13
- * @param {Object} obj
14
- * @param {Object} [options]
15
- * @param {Boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
13
+ * @param {object} obj
14
+ * @param {object} [options]
15
+ * @param {boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
16
16
  * @param {Function} [options.currentTime] if set, Mongoose will call this function to get the current time.
17
17
  */
18
18
 
@@ -29,9 +29,9 @@ function applyTimestamps(schema, obj, options) {
29
29
  * Apply timestamps to any subdocuments
30
30
  *
31
31
  * @param {Schema} schema subdocument schema
32
- * @param {Object} res subdocument
33
- * @param {Object} [options]
34
- * @param {Boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
32
+ * @param {object} res subdocument
33
+ * @param {object} [options]
34
+ * @param {boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
35
35
  * @param {Function} [options.currentTime] if set, Mongoose will call this function to get the current time.
36
36
  */
37
37
 
@@ -55,9 +55,9 @@ function applyTimestampsToChildren(schema, res, options) {
55
55
  * Apply timestamps to a given document. Does not apply timestamps to subdocuments: use `applyTimestampsToChildren` instead
56
56
  *
57
57
  * @param {Schema} schema
58
- * @param {Object} obj
59
- * @param {Object} [options]
60
- * @param {Boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
58
+ * @param {object} obj
59
+ * @param {object} [options]
60
+ * @param {boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
61
61
  * @param {Function} [options.currentTime] if set, Mongoose will call this function to get the current time.
62
62
  */
63
63
 
@@ -9,8 +9,8 @@ module.exports = applyVirtuals;
9
9
  * Apply a given schema's virtuals to a given POJO
10
10
  *
11
11
  * @param {Schema} schema
12
- * @param {Object} obj
13
- * @param {Array<string>} [virtuals] optional whitelist of virtuals to apply
12
+ * @param {object} obj
13
+ * @param {string[]} [virtuals] optional whitelist of virtuals to apply
14
14
  * @returns
15
15
  */
16
16
 
@@ -42,8 +42,8 @@ function applyVirtuals(schema, obj, virtuals) {
42
42
  * Apply virtuals to any subdocuments
43
43
  *
44
44
  * @param {Schema} schema subdocument schema
45
- * @param {Object} res subdocument
46
- * @param {Array<String>} [virtuals] optional whitelist of virtuals to apply
45
+ * @param {object} res subdocument
46
+ * @param {string[]} [virtuals] optional whitelist of virtuals to apply
47
47
  */
48
48
 
49
49
  function applyVirtualsToChildren(schema, res, virtuals) {
@@ -86,8 +86,8 @@ function applyVirtualsToChildren(schema, res, virtuals) {
86
86
  * Apply virtuals to a given document. Does not apply virtuals to subdocuments: use `applyVirtualsToChildren` instead
87
87
  *
88
88
  * @param {Schema} schema
89
- * @param {Object} doc
90
- * @param {Array<String>} [virtuals] optional whitelist of virtuals to apply
89
+ * @param {object} doc
90
+ * @param {string[]} [virtuals] optional whitelist of virtuals to apply
91
91
  * @returns
92
92
  */
93
93
 
@@ -31,10 +31,10 @@ const noDottedPathGetOptions = Object.freeze({
31
31
 
32
32
  /**
33
33
  * Compiles schemas.
34
- * @param {Object} tree
35
- * @param {Any} proto
36
- * @param {String} prefix
37
- * @param {Object} options
34
+ * @param {object} tree
35
+ * @param {any} proto
36
+ * @param {string} prefix
37
+ * @param {object} options
38
38
  * @api private
39
39
  */
40
40
 
@@ -56,12 +56,12 @@ function compile(tree, proto, prefix, options) {
56
56
 
57
57
  /**
58
58
  * Defines the accessor named prop on the incoming prototype.
59
- * @param {Object} options
60
- * @param {String} options.prop
61
- * @param {Boolean} options.subprops
62
- * @param {Any} options.prototype
63
- * @param {String} [options.prefix]
64
- * @param {Object} options.options
59
+ * @param {object} options
60
+ * @param {string} options.prop
61
+ * @param {boolean} options.subprops
62
+ * @param {any} options.prototype
63
+ * @param {string} [options.prefix]
64
+ * @param {object} options.options
65
65
  * @api private
66
66
  */
67
67
 
@@ -6,9 +6,9 @@
6
6
  * document.
7
7
  *
8
8
  * @param {Document} doc
9
- * @param {String[]} parts
9
+ * @param {string[]} parts
10
10
  * @param {Schema} schema
11
- * @returns Document
11
+ * @returns {Document}
12
12
  */
13
13
 
14
14
  module.exports = function getDeepestSubdocumentForPath(doc, parts, schema) {
@@ -8,8 +8,8 @@ const getSchemaDiscriminatorByValue = require('../discriminator/getSchemaDiscrim
8
8
  * determine path type without knowing the embedded discriminator key.
9
9
  *
10
10
  * @param {Document} doc
11
- * @param {String|String[]} path
12
- * @param {Object} [options]
11
+ * @param {string|string[]} path
12
+ * @param {object} [options]
13
13
  * @api private
14
14
  */
15
15
 
@@ -6,9 +6,9 @@ const utils = require('../../utils');
6
6
  * Given a Mongoose index definition (key + options objects) and a MongoDB server
7
7
  * index definition, determine if the two indexes are equal.
8
8
  *
9
- * @param {Object} schemaIndexKeysObject the Mongoose index spec
10
- * @param {Object} options the Mongoose index definition's options
11
- * @param {Object} dbIndex the index in MongoDB as returned by `listIndexes()`
9
+ * @param {object} schemaIndexKeysObject the Mongoose index spec
10
+ * @param {object} options the Mongoose index definition's options
11
+ * @param {object} dbIndex the index in MongoDB as returned by `listIndexes()`
12
12
  * @api private
13
13
  */
14
14
 
@@ -8,9 +8,9 @@
8
8
  * isIndexSpecEqual({ a: 1, b: 1 }, { b: 1, a: 1 }); // false
9
9
  * isIndexSpecEqual({ a: 1, b: -1 }, { a: 1, b: 1 }); // false
10
10
  *
11
- * @param {Object} spec1 The first index specification to compare.
12
- * @param {Object} spec2 The second index specification to compare.
13
- * @returns {Boolean} Returns true if the index specifications are equal, otherwise returns false.
11
+ * @param {object} spec1 The first index specification to compare.
12
+ * @param {object} spec2 The second index specification to compare.
13
+ * @returns {boolean} Returns true if the index specifications are equal, otherwise returns false.
14
14
  */
15
15
 
16
16
  module.exports = function isIndexSpecEqual(spec1, spec2) {
@@ -6,7 +6,7 @@ const isMongooseArray = require('../types/array/isMongooseArray').isMongooseArra
6
6
  *
7
7
  * This is for compatibility with libs like Date.js which do foolish things to Natives.
8
8
  *
9
- * @param {Any} v
9
+ * @param {any} v
10
10
  * @api private
11
11
  */
12
12
 
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * Determines if `arg` is an object.
5
5
  *
6
- * @param {Object|Array|String|Function|RegExp|any} arg
6
+ * @param {object|Array|string|Function|RegExp|any} arg
7
7
  * @api private
8
- * @return {Boolean}
8
+ * @return {boolean}
9
9
  */
10
10
 
11
11
  module.exports = function(arg) {
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * Determines if `arg` is a flat object.
5
5
  *
6
- * @param {Object|Array|String|Function|RegExp|any} arg
6
+ * @param {object|Array|string|Function|RegExp|any} arg
7
7
  * @api private
8
- * @return {Boolean}
8
+ * @return {boolean}
9
9
  */
10
10
 
11
11
  module.exports = function isSimpleValidator(obj) {
@@ -7,8 +7,8 @@ module.exports = minimize;
7
7
  /**
8
8
  * Minimizes an object, removing undefined values and empty objects
9
9
  *
10
- * @param {Object} object to minimize
11
- * @return {Object|undefined}
10
+ * @param {object} object to minimize
11
+ * @return {object|undefined}
12
12
  * @api private
13
13
  */
14
14
 
@@ -32,7 +32,7 @@ const alreadyHookedFunctions = new Set(applyHooks.middlewareFunctions.flatMap(fn
32
32
  *
33
33
  * @param {Model} model
34
34
  * @param {Schema} schema
35
- * @param {Object} options
35
+ * @param {object} options
36
36
  * @api private
37
37
  */
38
38
 
@@ -15,8 +15,8 @@ const setDefaultsOnInsert = require('../setDefaultsOnInsert');
15
15
  * Given a model and a bulkWrite op, return a thunk that handles casting and
16
16
  * validating the individual op.
17
17
  * @param {Model} originalModel
18
- * @param {Object} op
19
- * @param {Object} [options]
18
+ * @param {object} op
19
+ * @param {object} [options]
20
20
  * @api private
21
21
  */
22
22
 
@@ -76,7 +76,7 @@ const uncountables = exports.uncountables;
76
76
  * Pluralize function.
77
77
  *
78
78
  * @author TJ Holowaychuk (extracted from _ext.js_)
79
- * @param {String} string to pluralize
79
+ * @param {string} string to pluralize
80
80
  * @api private
81
81
  */
82
82
 
@@ -26,8 +26,8 @@ const kHasArray = Symbol('mongoose#assignRawDocsToIdStructure#hasArray');
26
26
  * @param {Array} rawIds
27
27
  * @param {Array} resultDocs
28
28
  * @param {Array} resultOrder
29
- * @param {Object} options
30
- * @param {Boolean} recursed
29
+ * @param {object} options
30
+ * @param {boolean} recursed
31
31
  * @api private
32
32
  */
33
33
 
@@ -256,11 +256,11 @@ function numDocs(v) {
256
256
  * background:
257
257
  * _ids are left in the query even when user excludes them so
258
258
  * that population mapping can occur.
259
- * @param {Any} val
260
- * @param {Object} assignmentOpts
261
- * @param {Object} populateOptions
259
+ * @param {any} val
260
+ * @param {object} assignmentOpts
261
+ * @param {object} populateOptions
262
262
  * @param {Function} [populateOptions.transform]
263
- * @param {Boolean} allIds
263
+ * @param {boolean} allIds
264
264
  * @api private
265
265
  */
266
266
 
@@ -327,7 +327,7 @@ function valueFilter(val, assignmentOpts, populateOptions, allIds) {
327
327
  /**
328
328
  * Remove _id from `subdoc` if user specified "lean" query option
329
329
  * @param {Document} subdoc
330
- * @param {Object} assignmentOpts
330
+ * @param {object} assignmentOpts
331
331
  * @api private
332
332
  */
333
333
 
@@ -344,7 +344,7 @@ function maybeRemoveId(subdoc, assignmentOpts) {
344
344
  /**
345
345
  * Determine if `obj` is something we can set a populated path to. Can be a
346
346
  * document, a lean document, or an array/map that contains docs.
347
- * @param {Any} obj
347
+ * @param {any} obj
348
348
  * @api private
349
349
  */
350
350