mongoose 9.2.0 → 9.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/lib/mongoose.js +2 -0
- package/package.json +1 -1
- package/types/index.d.ts +0 -23
- package/types/query.d.ts +12 -2
- package/types/types.d.ts +2 -2
package/lib/mongoose.js
CHANGED
|
@@ -243,6 +243,8 @@ Mongoose.prototype.setDriver = function setDriver(driver) {
|
|
|
243
243
|
* - `timestamps.createdAt.immutable`: `true` by default. If `false`, it will change the `createdAt` field to be [`immutable: false`](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.immutable) which means you can update the `createdAt`
|
|
244
244
|
* - `toJSON`: `{ transform: true, flattenDecimals: true }` by default. Overwrites default objects to [`toJSON()`](https://mongoosejs.com/docs/api/document.html#Document.prototype.toJSON()), for determining how Mongoose documents get serialized by `JSON.stringify()`
|
|
245
245
|
* - `toObject`: `{ transform: true, flattenDecimals: true }` by default. Overwrites default objects to [`toObject()`](https://mongoosejs.com/docs/api/document.html#Document.prototype.toObject())
|
|
246
|
+
* - `transactionAsyncLocalStorage`: `false` by default. If `true`, Mongoose will automatically pass the `session` to any operation executing within a transaction executor function. See [transaction AsyncLocalStorage documentation](https://mongoosejs.com/docs/transactions.html#asynclocalstorage)
|
|
247
|
+
* - `translateAliases`: `false` by default. If `true`, Mongoose will automatically translate aliases to their original paths before sending the query to MongoDB.
|
|
246
248
|
* - `updatePipeline`: `false` by default. If `true`, allows passing update pipelines (arrays) to update operations by default without explicitly setting `updatePipeline: true` in each query.
|
|
247
249
|
*
|
|
248
250
|
* @param {String|Object} key The name of the option or a object of multiple key-value pairs
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -945,29 +945,6 @@ declare module 'mongoose' {
|
|
|
945
945
|
: BufferToBinary<T[K]>;
|
|
946
946
|
} : T;
|
|
947
947
|
|
|
948
|
-
/**
|
|
949
|
-
* Converts any UUID properties into strings for JSON serialization
|
|
950
|
-
*/
|
|
951
|
-
export type UUIDToJSON<T> = T extends Types.UUID
|
|
952
|
-
? string
|
|
953
|
-
: T extends mongodb.UUID
|
|
954
|
-
? string
|
|
955
|
-
: T extends Document
|
|
956
|
-
? T
|
|
957
|
-
: T extends TreatAsPrimitives
|
|
958
|
-
? T
|
|
959
|
-
: T extends Record<string, any> ? {
|
|
960
|
-
[K in keyof T]: T[K] extends Types.UUID
|
|
961
|
-
? string
|
|
962
|
-
: T[K] extends mongodb.UUID
|
|
963
|
-
? string
|
|
964
|
-
: T[K] extends Types.DocumentArray<infer ItemType>
|
|
965
|
-
? Types.DocumentArray<UUIDToJSON<ItemType>>
|
|
966
|
-
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
|
|
967
|
-
? HydratedSingleSubdocument<UUIDToJSON<SubdocType>>
|
|
968
|
-
: UUIDToJSON<T[K]>;
|
|
969
|
-
} : T;
|
|
970
|
-
|
|
971
948
|
/**
|
|
972
949
|
* Converts any UUID properties into strings for JSON serialization
|
|
973
950
|
*/
|
package/types/query.d.ts
CHANGED
|
@@ -20,8 +20,18 @@ declare module 'mongoose' {
|
|
|
20
20
|
|
|
21
21
|
export type ApplyBasicQueryCasting<T> = QueryTypeCasting<T> | QueryTypeCasting<T[]> | (T extends (infer U)[] ? QueryTypeCasting<U> : T) | null;
|
|
22
22
|
|
|
23
|
-
type _QueryFilter<T> = (
|
|
24
|
-
|
|
23
|
+
type _QueryFilter<T> = (
|
|
24
|
+
{ [P in keyof T]?: mongodb.Condition<ApplyBasicQueryCasting<T[P]>>; } &
|
|
25
|
+
mongodb.RootFilterOperators<{ [P in keyof mongodb.WithId<T>]?: ApplyBasicQueryCasting<mongodb.WithId<T>[P]>; }>
|
|
26
|
+
);
|
|
27
|
+
type _QueryFilterLooseId<T> = (
|
|
28
|
+
{ [P in keyof T]?: mongodb.Condition<ApplyBasicQueryCasting<T[P]>>; } &
|
|
29
|
+
mongodb.RootFilterOperators<
|
|
30
|
+
{ [P in keyof T]?: ApplyBasicQueryCasting<T[P]>; } &
|
|
31
|
+
{ _id?: any; }
|
|
32
|
+
>
|
|
33
|
+
);
|
|
34
|
+
type QueryFilter<T> = IsItRecordAndNotAny<T> extends true ? _QueryFilter<WithLevel1NestedPaths<T>> : _QueryFilterLooseId<Record<string, any>>;
|
|
25
35
|
|
|
26
36
|
type MongooseBaseQueryOptionKeys =
|
|
27
37
|
| 'context'
|
package/types/types.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ declare module 'mongoose' {
|
|
|
84
84
|
class ObjectId extends mongodb.ObjectId {
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
class Subdocument<IdType = any, TQueryHelpers = any, DocType = any> extends Document<IdType, TQueryHelpers, DocType> {
|
|
87
|
+
class Subdocument<IdType = any, TQueryHelpers = any, DocType = any, TVirtuals = {}, TSchemaOptions = {}> extends Document<IdType, TQueryHelpers, DocType, TVirtuals, TSchemaOptions> {
|
|
88
88
|
$isSingleNested: true;
|
|
89
89
|
|
|
90
90
|
/** Returns the top level document of this sub-document. */
|
|
@@ -97,7 +97,7 @@ declare module 'mongoose' {
|
|
|
97
97
|
$parent(): Document;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
class ArraySubdocument<IdType = any, TQueryHelpers = unknown, DocType = unknown> extends Subdocument<IdType, TQueryHelpers, DocType> {
|
|
100
|
+
class ArraySubdocument<IdType = any, TQueryHelpers = unknown, DocType = unknown, TVirtuals = {}, TSchemaOptions = {}> extends Subdocument<IdType, TQueryHelpers, DocType, TVirtuals, TSchemaOptions> {
|
|
101
101
|
/** Returns this sub-documents parent array. */
|
|
102
102
|
parentArray(): Types.DocumentArray<unknown>;
|
|
103
103
|
}
|