mongoose 8.6.1 → 8.6.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/dist/browser.umd.js +1 -1
- package/lib/connection.js +3 -0
- package/lib/cursor/queryCursor.js +1 -1
- package/lib/document.js +1 -1
- package/lib/drivers/node-mongodb-native/connection.js +1 -1
- package/lib/plugins/trackTransaction.js +0 -7
- package/package.json +1 -1
- package/types/cursor.d.ts +1 -0
- package/types/inferrawdoctype.d.ts +2 -2
- package/types/inferschematype.d.ts +2 -2
- package/types/query.d.ts +3 -5
- package/types/schematypes.d.ts +3 -0
package/lib/connection.js
CHANGED
|
@@ -71,6 +71,9 @@ function Connection(base) {
|
|
|
71
71
|
} else {
|
|
72
72
|
this.id = base.nextConnectionId;
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
// Internal queue of objects `{ fn, ctx, args }` that Mongoose calls when this connection is successfully
|
|
76
|
+
// opened. In `onOpen()`, Mongoose calls every entry in `_queue` and empties the queue.
|
|
74
77
|
this._queue = [];
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -10,7 +10,7 @@ const eachAsync = require('../helpers/cursor/eachAsync');
|
|
|
10
10
|
const helpers = require('../queryHelpers');
|
|
11
11
|
const kareem = require('kareem');
|
|
12
12
|
const immediate = require('../helpers/immediate');
|
|
13
|
-
const { once } = require('
|
|
13
|
+
const { once } = require('events');
|
|
14
14
|
const util = require('util');
|
|
15
15
|
|
|
16
16
|
/**
|
package/lib/document.js
CHANGED
|
@@ -1213,7 +1213,7 @@ Document.prototype.$set = function $set(path, val, type, options) {
|
|
|
1213
1213
|
this.$__setValue(path, null);
|
|
1214
1214
|
cleanModifiedSubpaths(this, path);
|
|
1215
1215
|
} else {
|
|
1216
|
-
return this.$set(val, path, constructing);
|
|
1216
|
+
return this.$set(val, path, constructing, options);
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
1219
|
const keys = getKeysInSchemaOrder(this.$__schema, val, path);
|
|
@@ -27,13 +27,6 @@ module.exports = function trackTransaction(schema) {
|
|
|
27
27
|
initialState.atomics = _getAtomics(this);
|
|
28
28
|
|
|
29
29
|
session[sessionNewDocuments].set(this, initialState);
|
|
30
|
-
} else {
|
|
31
|
-
const state = session[sessionNewDocuments].get(this);
|
|
32
|
-
|
|
33
|
-
for (const path of Object.keys(this.$__.activePaths.getStatePaths('modify'))) {
|
|
34
|
-
state.modifiedPaths.add(path);
|
|
35
|
-
}
|
|
36
|
-
state.atomics = _getAtomics(this, state.atomics);
|
|
37
30
|
}
|
|
38
31
|
});
|
|
39
32
|
};
|
package/package.json
CHANGED
package/types/cursor.d.ts
CHANGED
|
@@ -91,8 +91,8 @@ declare module 'mongoose' {
|
|
|
91
91
|
IfEquals<PathValueType, String> extends true ? PathEnumOrString<Options['enum']> :
|
|
92
92
|
PathValueType extends NumberSchemaDefinition ? Options['enum'] extends ReadonlyArray<any> ? Options['enum'][number] : number :
|
|
93
93
|
IfEquals<PathValueType, Schema.Types.Number> extends true ? number :
|
|
94
|
-
PathValueType extends DateSchemaDefinition ?
|
|
95
|
-
IfEquals<PathValueType, Schema.Types.Date> extends true ?
|
|
94
|
+
PathValueType extends DateSchemaDefinition ? NativeDate :
|
|
95
|
+
IfEquals<PathValueType, Schema.Types.Date> extends true ? NativeDate :
|
|
96
96
|
PathValueType extends typeof Buffer | 'buffer' | 'Buffer' | typeof Schema.Types.Buffer ? Buffer :
|
|
97
97
|
PathValueType extends BooleanSchemaDefinition ? boolean :
|
|
98
98
|
IfEquals<PathValueType, Schema.Types.Boolean> extends true ? boolean :
|
|
@@ -281,8 +281,8 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
|
|
|
281
281
|
IfEquals<PathValueType, String> extends true ? PathEnumOrString<Options['enum']> :
|
|
282
282
|
PathValueType extends NumberSchemaDefinition ? Options['enum'] extends ReadonlyArray<any> ? Options['enum'][number] : number :
|
|
283
283
|
IfEquals<PathValueType, Schema.Types.Number> extends true ? number :
|
|
284
|
-
PathValueType extends DateSchemaDefinition ?
|
|
285
|
-
IfEquals<PathValueType, Schema.Types.Date> extends true ?
|
|
284
|
+
PathValueType extends DateSchemaDefinition ? NativeDate :
|
|
285
|
+
IfEquals<PathValueType, Schema.Types.Date> extends true ? NativeDate :
|
|
286
286
|
PathValueType extends typeof Buffer | 'buffer' | 'Buffer' | typeof Schema.Types.Buffer ? Buffer :
|
|
287
287
|
PathValueType extends BooleanSchemaDefinition ? boolean :
|
|
288
288
|
IfEquals<PathValueType, Schema.Types.Boolean> extends true ? boolean :
|
package/types/query.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare module 'mongoose' {
|
|
|
12
12
|
*/
|
|
13
13
|
type RootFilterQuery<T> = FilterQuery<T> | Query<any, any> | Types.ObjectId;
|
|
14
14
|
|
|
15
|
-
type FilterQuery<T> ={
|
|
15
|
+
type FilterQuery<T> = {
|
|
16
16
|
[P in keyof T]?: Condition<T[P]>;
|
|
17
17
|
} & RootQuerySelector<T> & { _id?: Condition<string>; };
|
|
18
18
|
|
|
@@ -117,10 +117,8 @@ declare module 'mongoose' {
|
|
|
117
117
|
/** @see https://www.mongodb.com/docs/manual/reference/operator/query/comment/#op._S_comment */
|
|
118
118
|
$comment?: string;
|
|
119
119
|
$expr?: Record<string, any>;
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
// they include a "." (to avoid generically allowing any unexpected keys)
|
|
123
|
-
[nestedSelector: `${string}.${string}`]: any;
|
|
120
|
+
// this will mark all unrecognized properties as any (including nested queries)
|
|
121
|
+
[key: string]: any;
|
|
124
122
|
};
|
|
125
123
|
|
|
126
124
|
interface QueryTimestampsConfig {
|
package/types/schematypes.d.ts
CHANGED
|
@@ -216,6 +216,9 @@ declare module 'mongoose' {
|
|
|
216
216
|
/** Attaches a getter for all instances of this schema type. */
|
|
217
217
|
static get(getter: (value: any) => any): void;
|
|
218
218
|
|
|
219
|
+
/** Array containing default setters for all instances of this SchemaType */
|
|
220
|
+
static setters: ((val?: unknown, priorVal?: unknown, doc?: Document<unknown>, options?: Record<string, any> | null) => unknown)[];
|
|
221
|
+
|
|
219
222
|
/** The class that Mongoose uses internally to instantiate this SchemaType's `options` property. */
|
|
220
223
|
OptionsConstructor: SchemaTypeOptions<T>;
|
|
221
224
|
|