mongoose 6.2.11 → 6.3.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.
- package/.eslintrc.json +157 -157
- package/README.md +1 -1
- package/dist/browser.umd.js +2 -1704
- package/lib/aggregate.js +4 -3
- package/lib/collection.js +0 -7
- package/lib/connection.js +2 -1
- package/lib/cursor/ChangeStream.js +42 -2
- package/lib/cursor/QueryCursor.js +2 -0
- package/lib/document.js +22 -26
- package/lib/error/cast.js +8 -2
- package/lib/error/eachAsyncMultiError.js +41 -0
- package/lib/helpers/common.js +0 -8
- package/lib/helpers/cursor/eachAsync.js +44 -12
- package/lib/helpers/immediate.js +3 -1
- package/lib/helpers/isAsyncFunction.js +19 -7
- package/lib/helpers/model/discriminator.js +1 -3
- package/lib/helpers/populate/getModelsMapForPopulate.js +13 -10
- package/lib/helpers/query/applyGlobalOption.js +29 -0
- package/lib/helpers/schematype/handleImmutable.js +4 -1
- package/lib/helpers/timestamps/setupTimestamps.js +2 -2
- package/lib/index.js +11 -4
- package/lib/internal.js +0 -1
- package/lib/model.js +39 -27
- package/lib/query.js +23 -4
- package/lib/queryhelpers.js +11 -1
- package/lib/schema/SubdocumentPath.js +3 -15
- package/lib/schema/documentarray.js +7 -7
- package/lib/schema/number.js +1 -5
- package/lib/schema/objectid.js +2 -4
- package/lib/schema/string.js +1 -5
- package/lib/schema.js +115 -2
- package/lib/schematype.js +2 -2
- package/lib/types/DocumentArray/methods/index.js +9 -1
- package/lib/types/array/methods/index.js +8 -9
- package/lib/validoptions.js +1 -0
- package/package.json +25 -18
- package/tools/repl.js +2 -1
- package/tsconfig.json +2 -2
- package/types/aggregate.d.ts +1 -2
- package/types/connection.d.ts +4 -5
- package/types/cursor.d.ts +13 -6
- package/types/document.d.ts +17 -14
- package/types/error.d.ts +124 -124
- package/types/index.d.ts +350 -202
- package/types/mongooseoptions.d.ts +11 -6
- package/types/schemaoptions.d.ts +1 -2
- package/CHANGELOG.md +0 -7238
- package/History.md +0 -1
- package/lib/helpers/query/applyGlobalMaxTimeMS.js +0 -15
package/lib/validoptions.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongoose",
|
|
3
3
|
"description": "Mongoose MongoDB ODM",
|
|
4
|
-
"version": "6.2
|
|
4
|
+
"version": "6.3.2",
|
|
5
5
|
"author": "Guillermo Rauch <guillermo@learnboost.com>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mongodb",
|
|
@@ -19,45 +19,50 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"bson": "^4.
|
|
22
|
+
"bson": "^4.6.2",
|
|
23
23
|
"kareem": "2.3.5",
|
|
24
|
-
"mongodb": "4.
|
|
25
|
-
"mpath": "0.
|
|
24
|
+
"mongodb": "4.5.0",
|
|
25
|
+
"mpath": "0.9.0",
|
|
26
26
|
"mquery": "4.0.2",
|
|
27
27
|
"ms": "2.1.3",
|
|
28
28
|
"sift": "16.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/core": "7.17.
|
|
32
|
-
"@babel/preset-env": "7.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
34
|
-
"@typescript-eslint/parser": "5.
|
|
31
|
+
"@babel/core": "7.17.10",
|
|
32
|
+
"@babel/preset-env": "7.17.10",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "5.21.0",
|
|
34
|
+
"@typescript-eslint/parser": "5.21.0",
|
|
35
35
|
"acquit": "1.2.1",
|
|
36
36
|
"acquit-ignore": "0.2.0",
|
|
37
37
|
"acquit-require": "0.1.1",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"assert-browserify": "2.0.0",
|
|
39
|
+
"axios": "0.27.2",
|
|
40
|
+
"babel-loader": "8.2.5",
|
|
40
41
|
"benchmark": "2.1.4",
|
|
41
42
|
"bluebird": "3.7.2",
|
|
43
|
+
"buffer": "6.0.3",
|
|
42
44
|
"cheerio": "1.0.0-rc.10",
|
|
45
|
+
"crypto-browserify": "3.12.0",
|
|
43
46
|
"dox": "0.3.1",
|
|
44
|
-
"eslint": "8.
|
|
47
|
+
"eslint": "8.14.0",
|
|
45
48
|
"eslint-plugin-mocha-no-only": "1.1.1",
|
|
46
|
-
"highlight.js": "11.5.
|
|
49
|
+
"highlight.js": "11.5.1",
|
|
47
50
|
"lodash.isequal": "4.5.0",
|
|
48
51
|
"lodash.isequalwith": "4.4.0",
|
|
49
|
-
"marked": "4.0.
|
|
50
|
-
"mocha": "
|
|
52
|
+
"marked": "4.0.14",
|
|
53
|
+
"mocha": "10.0.0",
|
|
51
54
|
"moment": "2.x",
|
|
52
|
-
"mongodb-memory-server": "
|
|
53
|
-
"nyc": "
|
|
55
|
+
"mongodb-memory-server": "8.5.2",
|
|
56
|
+
"nyc": "15.1.0",
|
|
54
57
|
"pug": "3.0.2",
|
|
55
58
|
"q": "1.5.1",
|
|
56
59
|
"serve-handler": "6.1.3",
|
|
60
|
+
"sinon": "13.0.2",
|
|
61
|
+
"stream-browserify": "3.0.0",
|
|
57
62
|
"tsd": "0.20.0",
|
|
58
|
-
"typescript": "4.6.
|
|
63
|
+
"typescript": "4.6.4",
|
|
59
64
|
"uuid": "8.3.2",
|
|
60
|
-
"webpack": "
|
|
65
|
+
"webpack": "5.72.0"
|
|
61
66
|
},
|
|
62
67
|
"directories": {
|
|
63
68
|
"lib": "./lib/mongoose"
|
|
@@ -72,6 +77,7 @@
|
|
|
72
77
|
"release-legacy": "git pull origin 5.x && git push origin 5.x --tags && npm publish --tag legacy",
|
|
73
78
|
"mongo": "node ./tools/repl.js",
|
|
74
79
|
"test": "mocha --exit ./test/*.test.js",
|
|
80
|
+
"test-rs": "START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js",
|
|
75
81
|
"test-tsd": "node ./test/types/check-types-filename && tsd",
|
|
76
82
|
"tdd": "mocha ./test/*.test.js ./test/typescript/main.test.js --inspect --watch --recursive --watch-files ./**/*.js",
|
|
77
83
|
"test-coverage": "nyc --reporter=html --reporter=text npm test"
|
|
@@ -115,6 +121,7 @@
|
|
|
115
121
|
"allowSyntheticDefaultImports": true,
|
|
116
122
|
"strictPropertyInitialization": false,
|
|
117
123
|
"noImplicitAny": false,
|
|
124
|
+
"strictNullChecks": true,
|
|
118
125
|
"module": "commonjs",
|
|
119
126
|
"target": "ES2017"
|
|
120
127
|
}
|
package/tools/repl.js
CHANGED
|
@@ -17,7 +17,8 @@ async function run() {
|
|
|
17
17
|
// Set the expiry job in MongoDB to run every second
|
|
18
18
|
{
|
|
19
19
|
port: 27017,
|
|
20
|
-
args: ['--setParameter', 'ttlMonitorSleepSecs=1']
|
|
20
|
+
args: ['--setParameter', 'ttlMonitorSleepSecs=1']
|
|
21
|
+
}
|
|
21
22
|
],
|
|
22
23
|
dbName: 'mongoose_test',
|
|
23
24
|
replSet: {
|
package/tsconfig.json
CHANGED
package/types/aggregate.d.ts
CHANGED
package/types/connection.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import mongodb = require('mongodb');
|
|
2
|
-
import events = require('events');
|
|
3
|
-
|
|
4
1
|
declare module 'mongoose' {
|
|
2
|
+
import mongodb = require('mongodb');
|
|
3
|
+
import events = require('events');
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Connection ready state
|
|
@@ -197,7 +196,7 @@ declare module 'mongoose' {
|
|
|
197
196
|
* async function executes successfully and attempt to retry if
|
|
198
197
|
* there was a retryable error.
|
|
199
198
|
*/
|
|
200
|
-
transaction
|
|
199
|
+
transaction(fn: (session: mongodb.ClientSession) => Promise<any>): Promise<void>;
|
|
201
200
|
|
|
202
201
|
/** Switches to a different database using the same connection pool. */
|
|
203
202
|
useDb(name: string, options?: { useCache?: boolean, noListener?: boolean }): Connection;
|
|
@@ -206,7 +205,7 @@ declare module 'mongoose' {
|
|
|
206
205
|
readonly user: string;
|
|
207
206
|
|
|
208
207
|
/** Watches the entire underlying database for changes. Similar to [`Model.watch()`](/docs/api/model.html#model_Model.watch). */
|
|
209
|
-
watch<ResultType = any>(pipeline?: Array<any>, options?: mongodb.ChangeStreamOptions): mongodb.ChangeStream<ResultType>;
|
|
208
|
+
watch<ResultType extends mongodb.Document = any>(pipeline?: Array<any>, options?: mongodb.ChangeStreamOptions): mongodb.ChangeStream<ResultType>;
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
}
|
package/types/cursor.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import stream = require('stream');
|
|
2
|
-
|
|
3
1
|
declare module 'mongoose' {
|
|
2
|
+
|
|
3
|
+
import stream = require('stream');
|
|
4
|
+
|
|
4
5
|
type CursorFlag = 'tailable' | 'oplogReplay' | 'noCursorTimeout' | 'awaitData' | 'partial';
|
|
5
6
|
|
|
7
|
+
interface EachAsyncOptions {
|
|
8
|
+
parallel?: number;
|
|
9
|
+
batchSize?: number;
|
|
10
|
+
continueOnError?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
class Cursor<DocType = any, Options = never> extends stream.Readable {
|
|
7
14
|
[Symbol.asyncIterator](): AsyncIterableIterator<DocType>;
|
|
8
15
|
|
|
@@ -25,10 +32,10 @@ declare module 'mongoose' {
|
|
|
25
32
|
* will wait for the promise to resolve before iterating on to the next one.
|
|
26
33
|
* Returns a promise that resolves when done.
|
|
27
34
|
*/
|
|
28
|
-
eachAsync(fn: (doc: DocType[]) => any, options:
|
|
29
|
-
eachAsync(fn: (doc: DocType) => any, options:
|
|
30
|
-
eachAsync(fn: (doc: DocType[]) => any, options:
|
|
31
|
-
eachAsync(fn: (doc: DocType) => any, options?:
|
|
35
|
+
eachAsync(fn: (doc: DocType[]) => any, options: EachAsyncOptions & { batchSize: number }, callback: CallbackWithoutResult): void;
|
|
36
|
+
eachAsync(fn: (doc: DocType) => any, options: EachAsyncOptions, callback: CallbackWithoutResult): void;
|
|
37
|
+
eachAsync(fn: (doc: DocType[]) => any, options: EachAsyncOptions & { batchSize: number }): Promise<void>;
|
|
38
|
+
eachAsync(fn: (doc: DocType) => any, options?: EachAsyncOptions): Promise<void>;
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* Registers a transform function which subsequently maps documents retrieved
|
package/types/document.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import mongodb = require('mongodb');
|
|
2
|
-
|
|
3
1
|
declare module 'mongoose' {
|
|
2
|
+
import mongodb = require('mongodb');
|
|
4
3
|
|
|
5
4
|
/** A list of paths to skip. If set, Mongoose will validate every modified path that is not in this list. */
|
|
6
5
|
type pathsToSkip = string[] | string;
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Generic types for Document:
|
|
9
|
+
* * T - the type of _id
|
|
10
|
+
* * TQueryHelpers - Object with any helpers that should be mixed into the Query type
|
|
11
|
+
* * DocType - the type of the actual Document created
|
|
12
|
+
*/
|
|
8
13
|
class Document<T = any, TQueryHelpers = any, DocType = any> {
|
|
9
14
|
constructor(doc?: any);
|
|
10
15
|
|
|
@@ -49,6 +54,9 @@ declare module 'mongoose' {
|
|
|
49
54
|
/** Marks a path as valid, removing existing validation errors. */
|
|
50
55
|
$markValid(path: string): void;
|
|
51
56
|
|
|
57
|
+
/** Returns the model with the given name on this document's associated connection. */
|
|
58
|
+
$model<ModelType = Model<unknown>>(name: string): ModelType;
|
|
59
|
+
|
|
52
60
|
/**
|
|
53
61
|
* A string containing the current operation that Mongoose is executing
|
|
54
62
|
* on this document. Can be `null`, `'save'`, `'validate'`, or `'remove'`.
|
|
@@ -169,9 +177,6 @@ declare module 'mongoose' {
|
|
|
169
177
|
/** The name of the model */
|
|
170
178
|
modelName: string;
|
|
171
179
|
|
|
172
|
-
/** Returns the model with the given name on this document's associated connection. */
|
|
173
|
-
model<ModelType = Model<unknown>>(name: string): ModelType;
|
|
174
|
-
|
|
175
180
|
/**
|
|
176
181
|
* Overwrite all values in this document with the values of `obj`, except
|
|
177
182
|
* for immutable properties. Behaves similarly to `set()`, except for it
|
|
@@ -186,10 +191,10 @@ declare module 'mongoose' {
|
|
|
186
191
|
$parent(): Document | undefined;
|
|
187
192
|
|
|
188
193
|
/** Populates document references. */
|
|
189
|
-
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<this & Paths>): void;
|
|
190
|
-
populate<Paths = {}>(path: string, names: string, callback: Callback<this & Paths>): void;
|
|
191
|
-
populate<Paths = {}>(path: string, names: string): Promise<this & Paths>;
|
|
192
194
|
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<this & Paths>;
|
|
195
|
+
populate<Paths = {}>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<this & Paths>): void;
|
|
196
|
+
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<unknown>, match?: AnyObject, options?: PopulateOptions): Promise<this & Paths>;
|
|
197
|
+
populate<Paths = {}>(path: string, select?: string | AnyObject, model?: Model<unknown>, match?: AnyObject, options?: PopulateOptions, callback?: Callback<this & Paths>): void;
|
|
193
198
|
|
|
194
199
|
/** Gets _id(s) used during population of the given `path`. If the path was not populated, returns `undefined`. */
|
|
195
200
|
populated(path: string): any;
|
|
@@ -216,13 +221,11 @@ declare module 'mongoose' {
|
|
|
216
221
|
set(value: any): this;
|
|
217
222
|
|
|
218
223
|
/** The return value of this method is used in calls to JSON.stringify(doc). */
|
|
219
|
-
toJSON(options
|
|
220
|
-
toJSON(options
|
|
221
|
-
toJSON<T = FlattenMaps<DocType>>(options?: ToObjectOptions): T;
|
|
224
|
+
toJSON<T = DocType>(options?: ToObjectOptions & { flattenMaps?: true }): FlattenMaps<LeanDocument<T>>;
|
|
225
|
+
toJSON<T = DocType>(options: ToObjectOptions & { flattenMaps: false }): LeanDocument<T>;
|
|
222
226
|
|
|
223
227
|
/** Converts this document into a plain-old JavaScript object ([POJO](https://masteringjs.io/tutorials/fundamentals/pojo)). */
|
|
224
|
-
toObject(options?: ToObjectOptions): LeanDocument<
|
|
225
|
-
toObject<T = DocType>(options?: ToObjectOptions): T;
|
|
228
|
+
toObject<T = DocType>(options?: ToObjectOptions): LeanDocument<T>;
|
|
226
229
|
|
|
227
230
|
/** Clears the modified state on the specified path. */
|
|
228
231
|
unmarkModified(path: string): void;
|
|
@@ -242,6 +245,6 @@ declare module 'mongoose' {
|
|
|
242
245
|
|
|
243
246
|
/** Executes registered validation rules (skipping asynchronous validators) for this document. */
|
|
244
247
|
validateSync(options: { pathsToSkip?: pathsToSkip, [k: string]: any }): Error.ValidationError | null;
|
|
245
|
-
validateSync(pathsToValidate?:
|
|
248
|
+
validateSync(pathsToValidate?: pathsToValidate, options?: AnyObject): Error.ValidationError | null;
|
|
246
249
|
}
|
|
247
250
|
}
|
package/types/error.d.ts
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
declare class NativeError extends global.Error { }
|
|
2
2
|
|
|
3
3
|
declare module 'mongoose' {
|
|
4
|
+
import mongodb = require('mongodb');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
constructor(doc: Document, currentVersion: number, modifiedPaths: Array<string>);
|
|
127
|
-
}
|
|
6
|
+
type CallbackError = NativeError | null;
|
|
7
|
+
|
|
8
|
+
class MongooseError extends global.Error {
|
|
9
|
+
constructor(msg: string);
|
|
10
|
+
|
|
11
|
+
/** The type of error. "MongooseError" for generic errors. */
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
static messages: any;
|
|
15
|
+
|
|
16
|
+
static Messages: any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
namespace Error {
|
|
20
|
+
export class CastError extends MongooseError {
|
|
21
|
+
name: 'CastError';
|
|
22
|
+
stringValue: string;
|
|
23
|
+
kind: string;
|
|
24
|
+
value: any;
|
|
25
|
+
path: string;
|
|
26
|
+
reason?: NativeError | null;
|
|
27
|
+
model?: any;
|
|
28
|
+
|
|
29
|
+
constructor(type: string, value: any, path: string, reason?: NativeError, schemaType?: SchemaType);
|
|
30
|
+
}
|
|
31
|
+
export class SyncIndexesError extends MongooseError {
|
|
32
|
+
name: 'SyncIndexesError';
|
|
33
|
+
errors?: Record<string, mongodb.MongoServerError>;
|
|
34
|
+
|
|
35
|
+
constructor(type: string, value: any, path: string, reason?: NativeError, schemaType?: SchemaType);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class DisconnectedError extends MongooseError {
|
|
39
|
+
name: 'DisconnectedError';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class DivergentArrayError extends MongooseError {
|
|
43
|
+
name: 'DivergentArrayError';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class MissingSchemaError extends MongooseError {
|
|
47
|
+
name: 'MissingSchemaError';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class DocumentNotFoundError extends MongooseError {
|
|
51
|
+
name: 'DocumentNotFoundError';
|
|
52
|
+
result: any;
|
|
53
|
+
numAffected: number;
|
|
54
|
+
filter: any;
|
|
55
|
+
query: any;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class ObjectExpectedError extends MongooseError {
|
|
59
|
+
name: 'ObjectExpectedError';
|
|
60
|
+
path: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class ObjectParameterError extends MongooseError {
|
|
64
|
+
name: 'ObjectParameterError';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class OverwriteModelError extends MongooseError {
|
|
68
|
+
name: 'OverwriteModelError';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class ParallelSaveError extends MongooseError {
|
|
72
|
+
name: 'ParallelSaveError';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class ParallelValidateError extends MongooseError {
|
|
76
|
+
name: 'ParallelValidateError';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class MongooseServerSelectionError extends MongooseError {
|
|
80
|
+
name: 'MongooseServerSelectionError';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export class StrictModeError extends MongooseError {
|
|
84
|
+
name: 'StrictModeError';
|
|
85
|
+
isImmutableError: boolean;
|
|
86
|
+
path: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class ValidationError extends MongooseError {
|
|
90
|
+
name: 'ValidationError';
|
|
91
|
+
|
|
92
|
+
errors: { [path: string]: ValidatorError | CastError };
|
|
93
|
+
addError: (path: string, error: ValidatorError | CastError) => void;
|
|
94
|
+
|
|
95
|
+
constructor(instance?: MongooseError);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export class ValidatorError extends MongooseError {
|
|
99
|
+
name: 'ValidatorError';
|
|
100
|
+
properties: {
|
|
101
|
+
message: string,
|
|
102
|
+
type?: string,
|
|
103
|
+
path?: string,
|
|
104
|
+
value?: any,
|
|
105
|
+
reason?: any
|
|
106
|
+
};
|
|
107
|
+
kind: string;
|
|
108
|
+
path: string;
|
|
109
|
+
value: any;
|
|
110
|
+
reason?: MongooseError | null;
|
|
111
|
+
|
|
112
|
+
constructor(properties: {
|
|
113
|
+
message?: string,
|
|
114
|
+
type?: string,
|
|
115
|
+
path?: string,
|
|
116
|
+
value?: any,
|
|
117
|
+
reason?: any
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export class VersionError extends MongooseError {
|
|
122
|
+
name: 'VersionError';
|
|
123
|
+
version: number;
|
|
124
|
+
modifiedPaths: Array<string>;
|
|
125
|
+
|
|
126
|
+
constructor(doc: Document, currentVersion: number, modifiedPaths: Array<string>);
|
|
128
127
|
}
|
|
128
|
+
}
|
|
129
129
|
}
|