mongoose 6.3.0 → 6.3.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.
- package/.eslintrc.json +157 -157
- package/README.md +2 -2
- package/dist/browser.umd.js +1 -1
- package/lib/collection.js +0 -7
- package/lib/connection.js +2 -1
- package/lib/document.js +65 -68
- package/lib/error/cast.js +8 -2
- package/lib/helpers/common.js +0 -8
- package/lib/helpers/immediate.js +3 -1
- package/lib/helpers/isAsyncFunction.js +19 -7
- package/lib/helpers/model/castBulkWrite.js +12 -0
- package/lib/helpers/populate/getModelsMapForPopulate.js +13 -10
- package/lib/helpers/query/cast$expr.js +4 -1
- package/lib/helpers/schematype/handleImmutable.js +4 -1
- package/lib/helpers/timestamps/setupTimestamps.js +2 -2
- package/lib/index.js +1 -1
- package/lib/internal.js +0 -1
- package/lib/model.js +42 -28
- package/lib/query.js +7 -3
- 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 +3 -6
- package/lib/schema.js +1 -1
- 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/utils.js +4 -0
- package/package.json +39 -19
- package/tsconfig.json +2 -2
- package/types/aggregate.d.ts +1 -2
- package/types/connection.d.ts +4 -5
- package/types/cursor.d.ts +3 -2
- package/types/document.d.ts +18 -15
- package/types/error.d.ts +124 -124
- package/types/index.d.ts +182 -154
- package/types/mongooseoptions.d.ts +1 -2
- package/types/schemaoptions.d.ts +1 -2
- package/CHANGELOG.md +0 -7249
- package/History.md +0 -1
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
|
}
|