mongoose 6.2.0 → 6.2.1
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.
- package/.eslintrc.json +150 -0
- package/CHANGELOG.md +21 -0
- package/dist/browser.umd.js +113 -112
- package/lib/aggregate.js +1 -1
- package/lib/document.js +83 -64
- package/lib/helpers/clone.js +40 -27
- package/lib/helpers/common.js +2 -2
- package/lib/helpers/getFunctionName.js +6 -4
- package/lib/helpers/isMongooseObject.js +9 -8
- package/lib/helpers/isObject.js +4 -4
- package/lib/helpers/path/parentPaths.js +10 -5
- package/lib/helpers/populate/assignRawDocsToIdStructure.js +4 -2
- package/lib/helpers/populate/assignVals.js +8 -4
- package/lib/helpers/populate/getModelsMapForPopulate.js +4 -4
- package/lib/helpers/populate/markArraySubdocsPopulated.js +3 -1
- package/lib/helpers/populate/modelNamesFromRefPath.js +4 -3
- package/lib/helpers/query/castUpdate.js +6 -2
- package/lib/helpers/schema/getPath.js +4 -2
- package/lib/helpers/timestamps/setupTimestamps.js +3 -8
- package/lib/index.js +2 -0
- package/lib/internal.js +1 -1
- package/lib/model.js +22 -8
- package/lib/plugins/trackTransaction.js +4 -3
- package/lib/query.js +3 -2
- package/lib/queryhelpers.js +1 -1
- package/lib/schema/array.js +17 -15
- package/lib/schema/documentarray.js +5 -8
- package/lib/schema/objectid.js +1 -1
- package/lib/schematype.js +29 -26
- package/lib/types/ArraySubdocument.js +2 -1
- package/lib/types/DocumentArray/index.js +9 -26
- package/lib/types/DocumentArray/isMongooseDocumentArray.js +5 -0
- package/lib/types/DocumentArray/methods/index.js +15 -3
- package/lib/types/array/index.js +21 -20
- package/lib/types/array/isMongooseArray.js +5 -0
- package/lib/types/array/methods/index.js +12 -12
- package/lib/utils.js +7 -0
- package/package.json +18 -147
- package/tools/repl.js +1 -1
- package/tsconfig.json +10 -0
- package/{index.d.ts → types/index.d.ts} +84 -75
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"eslint:recommended"
|
|
4
|
+
],
|
|
5
|
+
"ignorePatterns": [
|
|
6
|
+
"docs",
|
|
7
|
+
"tools",
|
|
8
|
+
"dist",
|
|
9
|
+
"test/files/*",
|
|
10
|
+
"benchmarks"
|
|
11
|
+
],
|
|
12
|
+
"overrides": [
|
|
13
|
+
{
|
|
14
|
+
"files": [
|
|
15
|
+
"**/*.{ts,tsx}"
|
|
16
|
+
],
|
|
17
|
+
"extends": [
|
|
18
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
19
|
+
"plugin:@typescript-eslint/recommended"
|
|
20
|
+
],
|
|
21
|
+
"plugins": [
|
|
22
|
+
"@typescript-eslint"
|
|
23
|
+
],
|
|
24
|
+
"rules": {
|
|
25
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
26
|
+
"@typescript-eslint/ban-types": "off",
|
|
27
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
28
|
+
"@typescript-eslint/explicit-module-boundary-types": "off"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"plugins": [
|
|
33
|
+
"mocha-no-only"
|
|
34
|
+
],
|
|
35
|
+
"parserOptions": {
|
|
36
|
+
"ecmaVersion": 2020
|
|
37
|
+
},
|
|
38
|
+
"env": {
|
|
39
|
+
"node": true,
|
|
40
|
+
"es6": true
|
|
41
|
+
},
|
|
42
|
+
"rules": {
|
|
43
|
+
"comma-style": "error",
|
|
44
|
+
"indent": [
|
|
45
|
+
"error",
|
|
46
|
+
2,
|
|
47
|
+
{
|
|
48
|
+
"SwitchCase": 1,
|
|
49
|
+
"VariableDeclarator": 2
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"keyword-spacing": "error",
|
|
53
|
+
"no-whitespace-before-property": "error",
|
|
54
|
+
"no-buffer-constructor": "warn",
|
|
55
|
+
"no-console": "off",
|
|
56
|
+
"no-constant-condition": "off",
|
|
57
|
+
"no-multi-spaces": "error",
|
|
58
|
+
"func-call-spacing": "error",
|
|
59
|
+
"no-trailing-spaces": "error",
|
|
60
|
+
"no-undef": "error",
|
|
61
|
+
"no-unneeded-ternary": "error",
|
|
62
|
+
"no-const-assign": "error",
|
|
63
|
+
"no-useless-rename": "error",
|
|
64
|
+
"no-dupe-keys": "error",
|
|
65
|
+
"space-in-parens": [
|
|
66
|
+
"error",
|
|
67
|
+
"never"
|
|
68
|
+
],
|
|
69
|
+
"spaced-comment": [
|
|
70
|
+
"error",
|
|
71
|
+
"always",
|
|
72
|
+
{
|
|
73
|
+
"block": {
|
|
74
|
+
"markers": [
|
|
75
|
+
"!"
|
|
76
|
+
],
|
|
77
|
+
"balanced": true
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"key-spacing": [
|
|
82
|
+
"error",
|
|
83
|
+
{
|
|
84
|
+
"beforeColon": false,
|
|
85
|
+
"afterColon": true
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"comma-spacing": [
|
|
89
|
+
"error",
|
|
90
|
+
{
|
|
91
|
+
"before": false,
|
|
92
|
+
"after": true
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"array-bracket-spacing": 1,
|
|
96
|
+
"arrow-spacing": [
|
|
97
|
+
"error",
|
|
98
|
+
{
|
|
99
|
+
"before": true,
|
|
100
|
+
"after": true
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"object-curly-spacing": [
|
|
104
|
+
"error",
|
|
105
|
+
"always"
|
|
106
|
+
],
|
|
107
|
+
"comma-dangle": [
|
|
108
|
+
"error",
|
|
109
|
+
"never"
|
|
110
|
+
],
|
|
111
|
+
"no-unreachable": "error",
|
|
112
|
+
"quotes": [
|
|
113
|
+
"error",
|
|
114
|
+
"single"
|
|
115
|
+
],
|
|
116
|
+
"quote-props": [
|
|
117
|
+
"error",
|
|
118
|
+
"as-needed"
|
|
119
|
+
],
|
|
120
|
+
"semi": "error",
|
|
121
|
+
"no-extra-semi": "error",
|
|
122
|
+
"semi-spacing": "error",
|
|
123
|
+
"no-spaced-func": "error",
|
|
124
|
+
"no-throw-literal": "error",
|
|
125
|
+
"space-before-blocks": "error",
|
|
126
|
+
"space-before-function-paren": [
|
|
127
|
+
"error",
|
|
128
|
+
"never"
|
|
129
|
+
],
|
|
130
|
+
"space-infix-ops": "error",
|
|
131
|
+
"space-unary-ops": "error",
|
|
132
|
+
"no-var": "warn",
|
|
133
|
+
"prefer-const": "warn",
|
|
134
|
+
"strict": [
|
|
135
|
+
"error",
|
|
136
|
+
"global"
|
|
137
|
+
],
|
|
138
|
+
"no-restricted-globals": [
|
|
139
|
+
"error",
|
|
140
|
+
{
|
|
141
|
+
"name": "context",
|
|
142
|
+
"message": "Don't use Mocha's global context"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"no-prototype-builtins": "off",
|
|
146
|
+
"mocha-no-only/mocha-no-only": [
|
|
147
|
+
"error"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
6.2.1 / 2022-02-07
|
|
2
|
+
==================
|
|
3
|
+
* perf: improve performance especially of validate and clone #11298 [Uzlopak](https://github.com/Uzlopak)
|
|
4
|
+
* perf: remove regexp-clone #11327 [Uzlopak](https://github.com/Uzlopak)
|
|
5
|
+
* fix(document): handle initing nested properties in non-strict documents #11309
|
|
6
|
+
* fix(query): cast $elemMatch underneath $all #11314
|
|
7
|
+
* fix(populate): respect schema-level strictPopulate option #11290
|
|
8
|
+
* fix: set default for dotted path projection #11293 [noseworthy](https://github.com/noseworthy)
|
|
9
|
+
* fix(model): correctly handle writeConcern.w = 0 when saving #11300
|
|
10
|
+
* fix(model): throw VersionError when saving with no changes and optimisticConcurrency = true #11295
|
|
11
|
+
* fix(query): avoid adding $each to $addToSet on mixed arrays #11284
|
|
12
|
+
* fix(index.d.ts): allow using type: [Schema.Types.ObjectId] for ObjectId arrays #11194
|
|
13
|
+
* fix(index.d.ts): make Types.DocumentArray<> convert type to subdoc, rename TMethods -> TMethodsAndOverrides #11061
|
|
14
|
+
* fix(index.d.ts): support passing generic to createCollection() and `collection()` for integration with MongoDB Node driver's collection class #11131
|
|
15
|
+
* fix(index.d.ts): add strictPopulate to MongooseOptions #11276
|
|
16
|
+
* docs: mark Mongoose 6 as compatible with MongoDB 4 #11320 [JavaScriptBach](https://github.com/JavaScriptBach)
|
|
17
|
+
* docs: remove documentation for useNestedStrict #11313 [mark-langer](https://github.com/mark-langer)
|
|
18
|
+
* docs: add "new" to ObjectId class in aggregate.js docs #11322 [JavanPoirier](https://github.com/JavanPoirier)
|
|
19
|
+
* chore: handle eslint configuration in .eslintrc.json #11326 [Uzlopak](https://github.com/Uzlopak)
|
|
20
|
+
* refactor: add parenthesis for constructors in tests #11330 [apeltop](https://github.com/apeltop)
|
|
21
|
+
|
|
1
22
|
6.2.0 / 2022-02-02
|
|
2
23
|
==================
|
|
3
24
|
* feat(connection+mongoose): add support for continueOnError for syncIndexes #11266 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
|