mongoose 6.4.0 → 6.4.3

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 (123) hide show
  1. package/.eslintrc.json +5 -2
  2. package/dist/browser.umd.js +68579 -2
  3. package/lib/cast/date.js +1 -1
  4. package/lib/cast/decimal128.js +1 -1
  5. package/lib/cast/objectid.js +1 -1
  6. package/lib/cast.js +1 -1
  7. package/lib/document.js +8 -2
  8. package/lib/drivers/node-mongodb-native/index.js +1 -1
  9. package/lib/error/parallelValidate.js +1 -1
  10. package/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +1 -1
  11. package/lib/helpers/aggregate/stringifyFunctionOperators.js +1 -1
  12. package/lib/helpers/arrayDepth.js +1 -1
  13. package/lib/helpers/cursor/eachAsync.js +1 -1
  14. package/lib/helpers/discriminator/areDiscriminatorValuesEqual.js +1 -1
  15. package/lib/helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection.js +1 -1
  16. package/lib/helpers/discriminator/getConstructor.js +1 -1
  17. package/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
  18. package/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
  19. package/lib/helpers/document/handleSpreadDoc.js +1 -1
  20. package/lib/helpers/each.js +1 -1
  21. package/lib/helpers/get.js +1 -1
  22. package/lib/helpers/getConstructorName.js +1 -1
  23. package/lib/helpers/getDefaultBulkwriteResult.js +1 -1
  24. package/lib/helpers/indexes/applySchemaCollation.js +1 -1
  25. package/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
  26. package/lib/helpers/indexes/isDefaultIdIndex.js +1 -1
  27. package/lib/helpers/indexes/isTextIndex.js +1 -1
  28. package/lib/helpers/isMongooseObject.js +1 -1
  29. package/lib/helpers/isObject.js +1 -1
  30. package/lib/helpers/isPromise.js +1 -1
  31. package/lib/helpers/model/applyHooks.js +1 -1
  32. package/lib/helpers/model/applyStaticHooks.js +1 -1
  33. package/lib/helpers/once.js +1 -1
  34. package/lib/helpers/path/flattenObjectWithDottedPaths.js +1 -1
  35. package/lib/helpers/path/parentPaths.js +1 -1
  36. package/lib/helpers/path/setDottedPath.js +1 -1
  37. package/lib/helpers/pluralize.js +1 -1
  38. package/lib/helpers/populate/SkipPopulateValue.js +1 -1
  39. package/lib/helpers/populate/assignRawDocsToIdStructure.js +1 -1
  40. package/lib/helpers/populate/assignVals.js +1 -1
  41. package/lib/helpers/populate/createPopulateQueryFilter.js +1 -1
  42. package/lib/helpers/populate/getModelsMapForPopulate.js +1 -1
  43. package/lib/helpers/populate/leanPopulateMap.js +1 -1
  44. package/lib/helpers/populate/lookupLocalFields.js +1 -1
  45. package/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  46. package/lib/helpers/populate/modelNamesFromRefPath.js +1 -1
  47. package/lib/helpers/populate/removeDeselectedForeignField.js +1 -1
  48. package/lib/helpers/populate/validateRef.js +1 -1
  49. package/lib/helpers/printJestWarning.js +1 -1
  50. package/lib/helpers/processConnectionOptions.js +1 -1
  51. package/lib/helpers/projection/applyProjection.js +1 -1
  52. package/lib/helpers/projection/hasIncludedChildren.js +1 -1
  53. package/lib/helpers/projection/parseProjection.js +1 -1
  54. package/lib/helpers/query/applyGlobalOption.js +1 -1
  55. package/lib/helpers/query/applyQueryMiddleware.js +1 -1
  56. package/lib/helpers/query/cast$expr.js +1 -1
  57. package/lib/helpers/query/castFilterPath.js +1 -1
  58. package/lib/helpers/query/sanitizeFilter.js +1 -1
  59. package/lib/helpers/query/sanitizeProjection.js +1 -1
  60. package/lib/helpers/query/trusted.js +1 -1
  61. package/lib/helpers/query/validOps.js +1 -1
  62. package/lib/helpers/query/wrapThunk.js +1 -1
  63. package/lib/helpers/schema/addAutoId.js +1 -1
  64. package/lib/helpers/schema/applyPlugins.js +1 -1
  65. package/lib/helpers/schema/cleanPositionalOperators.js +1 -1
  66. package/lib/helpers/schema/getKeysInSchemaOrder.js +1 -1
  67. package/lib/helpers/schema/getPath.js +1 -1
  68. package/lib/helpers/schema/handleIdOption.js +1 -1
  69. package/lib/helpers/schema/handleTimestampOption.js +1 -1
  70. package/lib/helpers/specialProperties.js +1 -1
  71. package/lib/helpers/symbols.js +1 -1
  72. package/lib/helpers/timers.js +1 -1
  73. package/lib/helpers/timestamps/setupTimestamps.js +1 -1
  74. package/lib/helpers/topology/allServersUnknown.js +1 -1
  75. package/lib/helpers/topology/isAtlas.js +1 -1
  76. package/lib/helpers/topology/isSSLError.js +1 -1
  77. package/lib/helpers/update/applyTimestampsToChildren.js +1 -1
  78. package/lib/helpers/update/castArrayFilters.js +1 -1
  79. package/lib/helpers/update/moveImmutableProperties.js +1 -1
  80. package/lib/helpers/update/removeUnusedArrayFilters.js +1 -1
  81. package/lib/helpers/update/updatedPathsByArrayFilter.js +1 -1
  82. package/lib/index.js +2 -2
  83. package/lib/options/PopulateOptions.js +1 -1
  84. package/lib/options/SchemaArrayOptions.js +1 -1
  85. package/lib/options/SchemaBufferOptions.js +1 -1
  86. package/lib/options/SchemaDocumentArrayOptions.js +1 -1
  87. package/lib/options/SchemaMapOptions.js +1 -1
  88. package/lib/options/SchemaNumberOptions.js +1 -1
  89. package/lib/options/SchemaObjectIdOptions.js +1 -1
  90. package/lib/options/SchemaSubdocumentOptions.js +1 -1
  91. package/lib/options/SchemaTypeOptions.js +1 -1
  92. package/lib/options/VirtualOptions.js +1 -1
  93. package/lib/options/propertyOptions.js +1 -1
  94. package/lib/options/removeOptions.js +1 -1
  95. package/lib/options/saveOptions.js +1 -1
  96. package/lib/plugins/trackTransaction.js +1 -1
  97. package/lib/queryhelpers.js +5 -0
  98. package/lib/schema/array.js +1 -1
  99. package/lib/schema/date.js +2 -2
  100. package/lib/schema/number.js +2 -2
  101. package/lib/schema/string.js +2 -2
  102. package/lib/schema/symbols.js +1 -1
  103. package/lib/schema.js +3 -3
  104. package/lib/schematype.js +2 -1
  105. package/lib/types/DocumentArray/methods/index.js +1 -1
  106. package/lib/types/buffer.js +26 -28
  107. package/lib/types/decimal128.js +3 -3
  108. package/lib/types/map.js +70 -0
  109. package/package.json +11 -11
  110. package/types/collection.d.ts +1 -1
  111. package/types/document.d.ts +12 -6
  112. package/types/expressions.d.ts +30 -9
  113. package/types/index.d.ts +13 -12
  114. package/types/{indizes.d.ts → indexes.d.ts} +2 -2
  115. package/types/inferschematype.d.ts +51 -33
  116. package/types/middlewares.d.ts +1 -1
  117. package/types/models.d.ts +14 -14
  118. package/types/mongooseoptions.d.ts +1 -1
  119. package/types/pipelinestage.d.ts +2 -2
  120. package/types/query.d.ts +1 -1
  121. package/types/schemaoptions.d.ts +1 -1
  122. package/types/types.d.ts +3 -1
  123. package/types/utility.d.ts +8 -1
package/lib/cast/date.js CHANGED
@@ -38,4 +38,4 @@ module.exports = function castDate(value) {
38
38
  }
39
39
 
40
40
  assert.ok(false);
41
- };
41
+ };
@@ -33,4 +33,4 @@ module.exports = function castDecimal128(value) {
33
33
  }
34
34
 
35
35
  assert.ok(false);
36
- };
36
+ };
@@ -26,4 +26,4 @@ module.exports = function castObjectId(value) {
26
26
  }
27
27
 
28
28
  return new ObjectId(value);
29
- };
29
+ };
package/lib/cast.js CHANGED
@@ -374,4 +374,4 @@ function _cast(val, numbertype, context) {
374
374
  }
375
375
  }
376
376
  }
377
- }
377
+ }
package/lib/document.js CHANGED
@@ -1035,6 +1035,7 @@ Document.prototype.overwrite = function overwrite(obj) {
1035
1035
  * @param {Any} val the value to set
1036
1036
  * @param {Schema|String|Number|Buffer|*} [type] optionally specify a type for "on-the-fly" attributes
1037
1037
  * @param {Object} [options] optionally specify options that modify the behavior of the set
1038
+ * @param {Boolean} [options.merge=false] if true, setting a [nested path](/docs/subdocs.html#subdocuments-versus-nested-paths) will merge existing values rather than overwrite the whole object. So `doc.set('nested', { a: 1, b: 2 })` becomes `doc.set('nested.a', 1); doc.set('nested.b', 2);`
1038
1039
  * @method $set
1039
1040
  * @name $set
1040
1041
  * @memberOf Document
@@ -1408,7 +1409,11 @@ Document.prototype.$set = function $set(path, val, type, options) {
1408
1409
  // later in `$__set()` because we don't take `_doc` when we iterate through
1409
1410
  // a single nested doc. That's to make sure we get the correct context.
1410
1411
  // Otherwise we would double-call the setter, see gh-7196.
1411
- val = schema.applySetters(val, this, false, priorVal, options);
1412
+ if (options != null && options.overwriteImmutable) {
1413
+ val = schema.applySetters(val, this, false, priorVal, { overwriteImmutable: true });
1414
+ } else {
1415
+ val = schema.applySetters(val, this, false, priorVal);
1416
+ }
1412
1417
  }
1413
1418
 
1414
1419
  if (Array.isArray(val) &&
@@ -4337,9 +4342,10 @@ Document.prototype.$populated = Document.prototype.populated;
4337
4342
  * doc.$assertPopulated('other path'); // throws an error
4338
4343
  *
4339
4344
  *
4340
- * @param {String | Array<String>} path
4345
+ * @param {String|Array<String>} path
4341
4346
  * @return {Document} this
4342
4347
  * @memberOf Document
4348
+ * @method $assertPopulated
4343
4349
  * @instance
4344
4350
  * @api public
4345
4351
  */
@@ -9,4 +9,4 @@ exports.Collection = require('./collection');
9
9
  exports.Decimal128 = require('./decimal128');
10
10
  exports.ObjectId = require('./objectid');
11
11
  exports.ReadPreference = require('./ReadPreference');
12
- exports.getConnection = () => require('./connection');
12
+ exports.getConnection = () => require('./connection');
@@ -28,4 +28,4 @@ Object.defineProperty(ParallelValidateError.prototype, 'name', {
28
28
  * exports
29
29
  */
30
30
 
31
- module.exports = ParallelValidateError;
31
+ module.exports = ParallelValidateError;
@@ -34,4 +34,4 @@ module.exports = function prepareDiscriminatorPipeline(pipeline, schema, prefix)
34
34
  originalPipeline.unshift({ $match: match });
35
35
  }
36
36
  }
37
- };
37
+ };
@@ -47,4 +47,4 @@ function handleAccumulator(operator) {
47
47
  operator.$accumulator[key] = String(operator.$accumulator[key]);
48
48
  }
49
49
  }
50
- }
50
+ }
@@ -30,4 +30,4 @@ function arrayDepth(arr) {
30
30
  res.max = res.max + 1;
31
31
 
32
32
  return res;
33
- }
33
+ }
@@ -189,4 +189,4 @@ function createEachAsyncMultiError(aggregatedErrors) {
189
189
  }
190
190
 
191
191
  return new EachAsyncMultiError(aggregatedErrors);
192
- }
192
+ }
@@ -13,4 +13,4 @@ module.exports = function areDiscriminatorValuesEqual(a, b) {
13
13
  return a.toString() === b.toString();
14
14
  }
15
15
  return false;
16
- };
16
+ };
@@ -9,4 +9,4 @@ module.exports = function checkEmbeddedDiscriminatorKeyProjection(userProjection
9
9
  addedPaths[0] === _discriminatorKey) {
10
10
  selected.splice(selected.indexOf(_discriminatorKey), 1);
11
11
  }
12
- };
12
+ };
@@ -22,4 +22,4 @@ module.exports = function getConstructor(Constructor, value) {
22
22
  }
23
23
 
24
24
  return Constructor;
25
- };
25
+ };
@@ -24,4 +24,4 @@ module.exports = function getDiscriminatorByValue(discriminators, value) {
24
24
  }
25
25
  }
26
26
  return null;
27
- };
27
+ };
@@ -23,4 +23,4 @@ module.exports = function getSchemaDiscriminatorByValue(schema, value) {
23
23
  }
24
24
  }
25
25
  return null;
26
- };
26
+ };
@@ -32,4 +32,4 @@ module.exports = function handleSpreadDoc(v, includeExtraKeys) {
32
32
  }
33
33
 
34
34
  return v;
35
- };
35
+ };
@@ -22,4 +22,4 @@ module.exports = function each(arr, cb, done) {
22
22
  }
23
23
  });
24
24
  }
25
- };
25
+ };
@@ -61,4 +61,4 @@ function getProperty(obj, prop) {
61
61
  return obj.get(prop);
62
62
  }
63
63
  return obj[prop];
64
- }
64
+ }
@@ -12,4 +12,4 @@ module.exports = function getConstructorName(val) {
12
12
  return void 0;
13
13
  }
14
14
  return val.constructor.name;
15
- };
15
+ };
@@ -24,4 +24,4 @@ function getDefaultBulkwriteResult() {
24
24
  };
25
25
  }
26
26
 
27
- module.exports = getDefaultBulkwriteResult;
27
+ module.exports = getDefaultBulkwriteResult;
@@ -10,4 +10,4 @@ module.exports = function applySchemaCollation(indexKeys, indexOptions, schemaOp
10
10
  if (schemaOptions.hasOwnProperty('collation') && !indexOptions.hasOwnProperty('collation')) {
11
11
  indexOptions.collation = schemaOptions.collation;
12
12
  }
13
- };
13
+ };
@@ -11,4 +11,4 @@ module.exports = function decorateDiscriminatorIndexOptions(schema, indexOptions
11
11
  indexOptions.partialFilterExpression[discriminatorKey] = discriminatorName;
12
12
  }
13
13
  return indexOptions;
14
- };
14
+ };
@@ -15,4 +15,4 @@ module.exports = function isDefaultIdIndex(index) {
15
15
 
16
16
  const key = get(index, 'key', {});
17
17
  return Object.keys(key).length === 1 && key.hasOwnProperty('_id');
18
- };
18
+ };
@@ -13,4 +13,4 @@ module.exports = function isTextIndex(indexKeys) {
13
13
  }
14
14
 
15
15
  return isTextIndex;
16
- };
16
+ };
@@ -19,4 +19,4 @@ module.exports = function(v) {
19
19
  v.$isMongooseMap // Map
20
20
  )
21
21
  );
22
- };
22
+ };
@@ -13,4 +13,4 @@ module.exports = function(arg) {
13
13
  Buffer.isBuffer(arg) ||
14
14
  Object.prototype.toString.call(arg) === '[object Object]'
15
15
  );
16
- };
16
+ };
@@ -3,4 +3,4 @@ function isPromise(val) {
3
3
  return !!val && (typeof val === 'object' || typeof val === 'function') && typeof val.then === 'function';
4
4
  }
5
5
 
6
- module.exports = isPromise;
6
+ module.exports = isPromise;
@@ -135,4 +135,4 @@ function applyHooks(model, schema, options) {
135
135
  objToDecorate[`$__${method}`] = middleware.
136
136
  createWrapper(method, originalMethod, null, customMethodOptions);
137
137
  }
138
- }
138
+ }
@@ -68,4 +68,4 @@ module.exports = function applyStaticHooks(model, hooks, statics) {
68
68
  };
69
69
  }
70
70
  }
71
- };
71
+ };
@@ -9,4 +9,4 @@ module.exports = function once(fn) {
9
9
  called = true;
10
10
  return fn.apply(null, arguments);
11
11
  };
12
- };
12
+ };
@@ -35,4 +35,4 @@ module.exports = function flattenObjectWithDottedPaths(obj) {
35
35
 
36
36
  flattenObjectWithDottedPaths(obj[key]);
37
37
  }
38
- };
38
+ };
@@ -15,4 +15,4 @@ module.exports = function parentPaths(path) {
15
15
  }
16
16
 
17
17
  return ret;
18
- };
18
+ };
@@ -30,4 +30,4 @@ module.exports = function setDottedPath(obj, path, val) {
30
30
  if (!specialProperties.has(last)) {
31
31
  cur[last] = val;
32
32
  }
33
- };
33
+ };
@@ -91,4 +91,4 @@ function pluralize(str) {
91
91
  }
92
92
  }
93
93
  return str;
94
- }
94
+ }
@@ -7,4 +7,4 @@ module.exports = function SkipPopulateValue(val) {
7
7
 
8
8
  this.val = val;
9
9
  return this;
10
- };
10
+ };
@@ -106,4 +106,4 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
106
106
  rawIds[i] = doc;
107
107
  });
108
108
  }
109
- }
109
+ }
@@ -320,4 +320,4 @@ function isPopulatedObject(obj) {
320
320
 
321
321
  function noop(v) {
322
322
  return v;
323
- }
323
+ }
@@ -77,4 +77,4 @@ function _formatMatch(match) {
77
77
  return Object.assign({}, match[0]);
78
78
  }
79
79
  return Object.assign({}, match);
80
- }
80
+ }
@@ -726,4 +726,4 @@ function _findRefPathForDiscriminators(doc, modelSchema, data, options, normaliz
726
726
  }
727
727
 
728
728
  return modelNames;
729
- }
729
+ }
@@ -4,4 +4,4 @@
4
4
  * ignore
5
5
  */
6
6
 
7
- module.exports = new WeakMap();
7
+ module.exports = new WeakMap();
@@ -37,4 +37,4 @@ module.exports = function lookupLocalFields(cur, path, val) {
37
37
  }
38
38
 
39
39
  return cur[path];
40
- };
40
+ };
@@ -39,4 +39,4 @@ module.exports = function markArraySubdocsPopulated(doc, populated) {
39
39
  }
40
40
  }
41
41
  }
42
- };
42
+ };
@@ -65,4 +65,4 @@ module.exports = function modelNamesFromRefPath(refPath, doc, populatedPath, mod
65
65
  modelNames = utils.array.flatten(modelNames);
66
66
 
67
67
  return modelNames;
68
- };
68
+ };
@@ -28,4 +28,4 @@ module.exports = function removeDeselectedForeignField(foreignFields, options, d
28
28
  }
29
29
  }
30
30
  }
31
- };
31
+ };
@@ -16,4 +16,4 @@ function validateRef(ref, path) {
16
16
 
17
17
  throw new MongooseError('Invalid ref at path "' + path + '". Got ' +
18
18
  util.inspect(ref, { depth: 0 }));
19
- }
19
+ }
@@ -14,4 +14,4 @@ if (typeof jest !== 'undefined' && process.nextTick.toString().indexOf('nextTick
14
14
  'with Jest\'s mock timers enabled. Please make sure you read ' +
15
15
  'Mongoose\'s docs on configuring Jest to test Node.js apps: ' +
16
16
  'https://mongoosejs.com/docs/jest.html');
17
- }
17
+ }
@@ -9,7 +9,7 @@ function processConnectionOptions(uri, options) {
9
9
  ? opts.readPreference
10
10
  : getUriReadPreference(uri);
11
11
 
12
- const resolvedOpts = (readPreference && readPreference !== 'primary')
12
+ const resolvedOpts = (readPreference && readPreference !== 'primary' && readPreference !== 'primaryPreferred')
13
13
  ? resolveOptsConflicts(readPreference, opts)
14
14
  : opts;
15
15
 
@@ -74,4 +74,4 @@ function applyInclusiveProjection(doc, projection, hasIncludedChildren, projecti
74
74
  }
75
75
  }
76
76
  return ret;
77
- }
77
+ }
@@ -33,4 +33,4 @@ module.exports = function hasIncludedChildren(fields) {
33
33
  }
34
34
 
35
35
  return hasIncludedChildren;
36
- };
36
+ };
@@ -30,4 +30,4 @@ module.exports = function parseProjection(v, retainMinusPaths) {
30
30
  }
31
31
 
32
32
  return ret;
33
- };
33
+ };
@@ -26,4 +26,4 @@ function applyGlobalOption(options, model, optionName) {
26
26
  } else if (utils.hasUserDefinedProperty(model.base.options, optionName)) {
27
27
  options[optionName] = model.base.options[optionName];
28
28
  }
29
- }
29
+ }
@@ -75,4 +75,4 @@ function _getContexts(hook) {
75
75
  ret.document = hook.document;
76
76
  }
77
77
  return ret;
78
- }
78
+ }
@@ -279,4 +279,4 @@ function isLiteral(val) {
279
279
  return val.$literal != null;
280
280
  }
281
281
  return true;
282
- }
282
+ }
@@ -51,4 +51,4 @@ module.exports = function castFilterPath(query, schematype, val) {
51
51
  }
52
52
 
53
53
  return val;
54
- };
54
+ };
@@ -35,4 +35,4 @@ module.exports = function sanitizeFilter(filter) {
35
35
  }
36
36
 
37
37
  return filter;
38
- };
38
+ };
@@ -11,4 +11,4 @@ module.exports = function sanitizeProjection(projection) {
11
11
  projection[keys[i]] = 1;
12
12
  }
13
13
  }
14
- };
14
+ };
@@ -10,4 +10,4 @@ exports.trusted = function trusted(obj) {
10
10
  }
11
11
  obj[trustedSymbol] = true;
12
12
  return obj;
13
- };
13
+ };
@@ -21,4 +21,4 @@ module.exports = Object.freeze([
21
21
  'findOneAndDelete',
22
22
  'findOneAndRemove',
23
23
  'remove'
24
- ]);
24
+ ]);
@@ -26,4 +26,4 @@ module.exports = function wrapThunk(fn) {
26
26
 
27
27
  fn.call(this, cb);
28
28
  };
29
- };
29
+ };
@@ -4,4 +4,4 @@ module.exports = function addAutoId(schema) {
4
4
  const _obj = { _id: { auto: true } };
5
5
  _obj._id[schema.options.typeKey] = 'ObjectId';
6
6
  schema.add(_obj);
7
- };
7
+ };
@@ -52,4 +52,4 @@ module.exports = function applyPlugins(schema, plugins, options, cacheKey) {
52
52
  applyPlugins(discriminatorSchema, plugins,
53
53
  { skipTopLevel: !applyPluginsToDiscriminators }, cacheKey);
54
54
  }
55
- };
55
+ };
@@ -9,4 +9,4 @@ module.exports = function cleanPositionalOperators(path) {
9
9
  return path.
10
10
  replace(/\.\$(\[[^\]]*\])?(?=\.)/g, '.0').
11
11
  replace(/\.\$(\[[^\]]*\])?$/g, '.0');
12
- };
12
+ };
@@ -25,4 +25,4 @@ module.exports = function getKeysInSchemaOrder(schema, val, path) {
25
25
  }
26
26
 
27
27
  return keys;
28
- };
28
+ };
@@ -34,4 +34,4 @@ module.exports = function getPath(schema, path) {
34
34
  }
35
35
 
36
36
  return schematype;
37
- };
37
+ };
@@ -17,4 +17,4 @@ module.exports = function handleIdOption(schema, options) {
17
17
  }
18
18
 
19
19
  return schema;
20
- };
20
+ };
@@ -21,4 +21,4 @@ function handleTimestampOption(arg, prop) {
21
21
  return prop;
22
22
  }
23
23
  return arg[prop];
24
- }
24
+ }
@@ -1,3 +1,3 @@
1
1
  'use strict';
2
2
 
3
- module.exports = new Set(['__proto__', 'constructor', 'prototype']);
3
+ module.exports = new Set(['__proto__', 'constructor', 'prototype']);
@@ -17,4 +17,4 @@ exports.populateModelSymbol = Symbol('mongoose.PopulateOptions#Model');
17
17
  exports.schemaTypeSymbol = Symbol('mongoose#schemaType');
18
18
  exports.sessionNewDocuments = Symbol('mongoose:ClientSession#newDocuments');
19
19
  exports.scopeSymbol = Symbol('mongoose#Document#scope');
20
- exports.validatorErrorSymbol = Symbol('mongoose:validatorError');
20
+ exports.validatorErrorSymbol = Symbol('mongoose:validatorError');
@@ -1,3 +1,3 @@
1
1
  'use strict';
2
2
 
3
- exports.setTimeout = setTimeout;
3
+ exports.setTimeout = setTimeout;
@@ -102,4 +102,4 @@ module.exports = function setupTimestamps(schema, timestamps) {
102
102
  applyTimestampsToChildren(now, this.getUpdate(), this.model.schema);
103
103
  next();
104
104
  }
105
- };
105
+ };
@@ -9,4 +9,4 @@ module.exports = function allServersUnknown(topologyDescription) {
9
9
 
10
10
  const servers = Array.from(topologyDescription.servers.values());
11
11
  return servers.length > 0 && servers.every(server => server.type === 'Unknown');
12
- };
12
+ };
@@ -23,4 +23,4 @@ module.exports = function isAtlas(topologyDescription) {
23
23
  }
24
24
  }
25
25
  return true;
26
- };
26
+ };
@@ -13,4 +13,4 @@ module.exports = function isSSLError(topologyDescription) {
13
13
  const descriptions = Array.from(topologyDescription.servers.values());
14
14
  return descriptions.length > 0 &&
15
15
  descriptions.every(descr => descr.error && descr.error.message.indexOf(nonSSLMessage) !== -1);
16
- };
16
+ };
@@ -186,4 +186,4 @@ function applyTimestampsToUpdateKey(schema, key, update, now) {
186
186
  update[key][createdAt] = now;
187
187
  }
188
188
  }
189
- }
189
+ }
@@ -80,4 +80,4 @@ function _castArrayFilters(arrayFilters, schema, strictQuery, updatedPathsByFilt
80
80
  }
81
81
  }
82
82
  }
83
- }
83
+ }
@@ -50,4 +50,4 @@ function _walkUpdatePath(schema, op, path, update, ctx) {
50
50
  update.$setOnInsert = update.$setOnInsert || {};
51
51
  update.$setOnInsert[path] = op[path];
52
52
  delete op[path];
53
- }
53
+ }
@@ -29,4 +29,4 @@ function _checkSingleFilterKey(arrayFilter, updateKeys) {
29
29
  const arrayFilterKey = firstDot === -1 ? firstKey : firstKey.slice(0, firstDot);
30
30
 
31
31
  return updateKeys.find(key => key.includes('$[' + arrayFilterKey + ']')) != null;
32
- }
32
+ }
@@ -24,4 +24,4 @@ module.exports = function updatedPathsByArrayFilter(update) {
24
24
  }
25
25
  return cur;
26
26
  }, {});
27
- };
27
+ };
package/lib/index.js CHANGED
@@ -1223,7 +1223,7 @@ Mongoose.prototype._promiseOrCallback = function(callback, fn, ee) {
1223
1223
  /**
1224
1224
  * Use this function in `pre()` middleware to skip calling the wrapped function.
1225
1225
  *
1226
- * ####Example:
1226
+ * #### Example:
1227
1227
  *
1228
1228
  * schema.pre('save', function() {
1229
1229
  * // Will skip executing `save()`, but will execute post hooks as if
@@ -1241,7 +1241,7 @@ Mongoose.prototype.skipMiddlewareFunction = Kareem.skipWrappedFunction;
1241
1241
  /**
1242
1242
  * Use this function in `post()` middleware to replace the result
1243
1243
  *
1244
- * ####Example:
1244
+ * #### Example:
1245
1245
  *
1246
1246
  * schema.post('find', function(res) {
1247
1247
  * // Normally you have to modify `res` in place. But with
@@ -33,4 +33,4 @@ class PopulateOptions {
33
33
  * @api public
34
34
  */
35
35
 
36
- module.exports = PopulateOptions;
36
+ module.exports = PopulateOptions;