mongoose 6.3.9 → 6.4.2

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 (129) hide show
  1. package/.eslintrc.json +65 -36
  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/connection.js +47 -5
  8. package/lib/document.js +48 -8
  9. package/lib/drivers/node-mongodb-native/index.js +1 -1
  10. package/lib/error/parallelValidate.js +1 -1
  11. package/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +1 -1
  12. package/lib/helpers/aggregate/stringifyFunctionOperators.js +1 -1
  13. package/lib/helpers/arrayDepth.js +1 -1
  14. package/lib/helpers/cursor/eachAsync.js +1 -1
  15. package/lib/helpers/discriminator/areDiscriminatorValuesEqual.js +1 -1
  16. package/lib/helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection.js +1 -1
  17. package/lib/helpers/discriminator/getConstructor.js +1 -1
  18. package/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
  19. package/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
  20. package/lib/helpers/document/handleSpreadDoc.js +1 -1
  21. package/lib/helpers/each.js +1 -1
  22. package/lib/helpers/get.js +1 -1
  23. package/lib/helpers/getConstructorName.js +1 -1
  24. package/lib/helpers/getDefaultBulkwriteResult.js +1 -1
  25. package/lib/helpers/indexes/applySchemaCollation.js +1 -1
  26. package/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
  27. package/lib/helpers/indexes/isDefaultIdIndex.js +1 -1
  28. package/lib/helpers/indexes/isTextIndex.js +1 -1
  29. package/lib/helpers/isMongooseObject.js +1 -1
  30. package/lib/helpers/isObject.js +1 -1
  31. package/lib/helpers/isPromise.js +1 -1
  32. package/lib/helpers/model/applyHooks.js +1 -1
  33. package/lib/helpers/model/applyStaticHooks.js +1 -1
  34. package/lib/helpers/once.js +1 -1
  35. package/lib/helpers/path/flattenObjectWithDottedPaths.js +1 -1
  36. package/lib/helpers/path/parentPaths.js +1 -1
  37. package/lib/helpers/path/setDottedPath.js +1 -1
  38. package/lib/helpers/pluralize.js +1 -1
  39. package/lib/helpers/populate/SkipPopulateValue.js +1 -1
  40. package/lib/helpers/populate/assignRawDocsToIdStructure.js +1 -1
  41. package/lib/helpers/populate/assignVals.js +1 -1
  42. package/lib/helpers/populate/createPopulateQueryFilter.js +1 -1
  43. package/lib/helpers/populate/getModelsMapForPopulate.js +1 -1
  44. package/lib/helpers/populate/leanPopulateMap.js +1 -1
  45. package/lib/helpers/populate/lookupLocalFields.js +1 -1
  46. package/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  47. package/lib/helpers/populate/modelNamesFromRefPath.js +1 -1
  48. package/lib/helpers/populate/removeDeselectedForeignField.js +1 -1
  49. package/lib/helpers/populate/validateRef.js +1 -1
  50. package/lib/helpers/printJestWarning.js +1 -1
  51. package/lib/helpers/processConnectionOptions.js +1 -1
  52. package/lib/helpers/projection/applyProjection.js +1 -1
  53. package/lib/helpers/projection/hasIncludedChildren.js +1 -1
  54. package/lib/helpers/projection/parseProjection.js +1 -1
  55. package/lib/helpers/query/applyGlobalOption.js +1 -1
  56. package/lib/helpers/query/applyQueryMiddleware.js +1 -1
  57. package/lib/helpers/query/cast$expr.js +1 -1
  58. package/lib/helpers/query/castFilterPath.js +1 -1
  59. package/lib/helpers/query/sanitizeFilter.js +1 -1
  60. package/lib/helpers/query/sanitizeProjection.js +1 -1
  61. package/lib/helpers/query/trusted.js +1 -1
  62. package/lib/helpers/query/validOps.js +1 -1
  63. package/lib/helpers/query/wrapThunk.js +1 -1
  64. package/lib/helpers/schema/addAutoId.js +1 -1
  65. package/lib/helpers/schema/applyPlugins.js +1 -1
  66. package/lib/helpers/schema/cleanPositionalOperators.js +1 -1
  67. package/lib/helpers/schema/getKeysInSchemaOrder.js +1 -1
  68. package/lib/helpers/schema/getPath.js +1 -1
  69. package/lib/helpers/schema/handleIdOption.js +1 -1
  70. package/lib/helpers/schema/handleTimestampOption.js +1 -1
  71. package/lib/helpers/specialProperties.js +1 -1
  72. package/lib/helpers/symbols.js +1 -1
  73. package/lib/helpers/timers.js +1 -1
  74. package/lib/helpers/timestamps/setupTimestamps.js +5 -2
  75. package/lib/helpers/topology/allServersUnknown.js +1 -1
  76. package/lib/helpers/topology/isAtlas.js +1 -1
  77. package/lib/helpers/topology/isSSLError.js +1 -1
  78. package/lib/helpers/update/applyTimestampsToChildren.js +1 -1
  79. package/lib/helpers/update/castArrayFilters.js +1 -1
  80. package/lib/helpers/update/moveImmutableProperties.js +1 -1
  81. package/lib/helpers/update/removeUnusedArrayFilters.js +1 -1
  82. package/lib/helpers/update/updatedPathsByArrayFilter.js +1 -1
  83. package/lib/helpers/updateValidators.js +11 -18
  84. package/lib/index.js +108 -29
  85. package/lib/model.js +1 -1
  86. package/lib/options/PopulateOptions.js +1 -1
  87. package/lib/options/SchemaArrayOptions.js +1 -1
  88. package/lib/options/SchemaBufferOptions.js +1 -1
  89. package/lib/options/SchemaDocumentArrayOptions.js +1 -1
  90. package/lib/options/SchemaMapOptions.js +1 -1
  91. package/lib/options/SchemaNumberOptions.js +1 -1
  92. package/lib/options/SchemaObjectIdOptions.js +1 -1
  93. package/lib/options/SchemaSubdocumentOptions.js +1 -1
  94. package/lib/options/SchemaTypeOptions.js +1 -1
  95. package/lib/options/VirtualOptions.js +1 -1
  96. package/lib/options/propertyOptions.js +1 -1
  97. package/lib/options/removeOptions.js +1 -1
  98. package/lib/options/saveOptions.js +1 -1
  99. package/lib/plugins/trackTransaction.js +1 -1
  100. package/lib/query.js +61 -6
  101. package/lib/queryhelpers.js +5 -0
  102. package/lib/schema/array.js +1 -1
  103. package/lib/schema/date.js +2 -2
  104. package/lib/schema/documentarray.js +10 -0
  105. package/lib/schema/number.js +2 -2
  106. package/lib/schema/string.js +2 -2
  107. package/lib/schema/symbols.js +1 -1
  108. package/lib/schema.js +6 -7
  109. package/lib/statemachine.js +13 -0
  110. package/lib/types/DocumentArray/methods/index.js +1 -1
  111. package/lib/utils.js +3 -0
  112. package/lib/validoptions.js +1 -0
  113. package/package.json +3 -3
  114. package/tsconfig.json +1 -0
  115. package/types/collection.d.ts +1 -1
  116. package/types/connection.d.ts +5 -0
  117. package/types/document.d.ts +15 -6
  118. package/types/expressions.d.ts +2882 -0
  119. package/types/index.d.ts +46 -17
  120. package/types/{indizes.d.ts → indexes.d.ts} +2 -2
  121. package/types/inferschematype.d.ts +173 -0
  122. package/types/middlewares.d.ts +1 -1
  123. package/types/models.d.ts +86 -71
  124. package/types/mongooseoptions.d.ts +9 -1
  125. package/types/pipelinestage.d.ts +76 -80
  126. package/types/query.d.ts +1 -1
  127. package/types/schemaoptions.d.ts +22 -4
  128. package/types/types.d.ts +3 -1
  129. package/types/utility.d.ts +9 -0
package/.eslintrc.json CHANGED
@@ -4,43 +4,71 @@
4
4
  ],
5
5
  "ignorePatterns": [
6
6
  "docs",
7
+ "tools",
7
8
  "dist",
8
- "test/files/*"
9
+ "website.js",
10
+ "test/files/*",
11
+ "benchmarks"
9
12
  ],
10
- "overrides": [{
11
- "files": [
12
- "**/*.{ts,tsx}"
13
- ],
14
- "extends": [
15
- "plugin:@typescript-eslint/eslint-recommended",
16
- "plugin:@typescript-eslint/recommended"
17
- ],
18
- "plugins": [
19
- "@typescript-eslint"
20
- ],
21
- "rules": {
22
- "@typescript-eslint/triple-slash-reference": "off",
23
- "spaced-comment": ["error", "always", {
24
- "markers": ["/"]
25
- }],
26
- "@typescript-eslint/no-explicit-any": "off",
27
- "@typescript-eslint/ban-types": "off",
28
- "@typescript-eslint/no-unused-vars": "off",
29
- "@typescript-eslint/explicit-module-boundary-types": "off",
30
- "@typescript-eslint/indent": ["error", 2, {
31
- "SwitchCase": 1
32
- }],
33
- "@typescript-eslint/prefer-optional-chain": "error",
34
- "@typescript-eslint/brace-style": "error",
35
- "@typescript-eslint/no-dupe-class-members": "error",
36
- "@typescript-eslint/no-redeclare": "error",
37
- "@typescript-eslint/type-annotation-spacing": "error",
38
- "@typescript-eslint/object-curly-spacing": ["error", "always"],
39
- "@typescript-eslint/semi": "error",
40
- "@typescript-eslint/space-before-function-paren": ["error", "never"],
41
- "@typescript-eslint/space-infix-ops": "off"
13
+ "overrides": [
14
+ {
15
+ "files": [
16
+ "**/*.{ts,tsx}"
17
+ ],
18
+ "extends": [
19
+ "plugin:@typescript-eslint/eslint-recommended",
20
+ "plugin:@typescript-eslint/recommended"
21
+ ],
22
+ "plugins": [
23
+ "@typescript-eslint"
24
+ ],
25
+ "rules": {
26
+ "@typescript-eslint/triple-slash-reference": "off",
27
+ "@typescript-eslint/no-non-null-assertion": "off",
28
+ "spaced-comment": [
29
+ "error",
30
+ "always",
31
+ {
32
+ "block": {
33
+ "markers": [
34
+ "!"
35
+ ],
36
+ "balanced": true
37
+ },
38
+ "markers": [
39
+ "/"
40
+ ]
41
+ }
42
+ ],
43
+ "@typescript-eslint/no-explicit-any": "off",
44
+ "@typescript-eslint/ban-types": "off",
45
+ "@typescript-eslint/no-unused-vars": "off",
46
+ "@typescript-eslint/explicit-module-boundary-types": "off",
47
+ "@typescript-eslint/indent": [
48
+ "error",
49
+ 2,
50
+ {
51
+ "SwitchCase": 1
52
+ }
53
+ ],
54
+ "@typescript-eslint/prefer-optional-chain": "error",
55
+ "@typescript-eslint/brace-style": "error",
56
+ "@typescript-eslint/no-dupe-class-members": "error",
57
+ "@typescript-eslint/no-redeclare": "error",
58
+ "@typescript-eslint/type-annotation-spacing": "error",
59
+ "@typescript-eslint/object-curly-spacing": [
60
+ "error",
61
+ "always"
62
+ ],
63
+ "@typescript-eslint/semi": "error",
64
+ "@typescript-eslint/space-before-function-paren": [
65
+ "error",
66
+ "never"
67
+ ],
68
+ "@typescript-eslint/space-infix-ops": "off"
69
+ }
42
70
  }
43
- }],
71
+ ],
44
72
  "plugins": [
45
73
  "mocha-no-only"
46
74
  ],
@@ -158,6 +186,7 @@
158
186
  "mocha-no-only/mocha-no-only": [
159
187
  "error"
160
188
  ],
161
- "no-empty": "off"
189
+ "no-empty": "off",
190
+ "eol-last": "warn"
162
191
  }
163
- }
192
+ }