Comparing version 8.5.2 to 8.5.3
@@ -724,2 +724,3 @@ 'use strict'; | ||
this._registerAtomic('$push', atomic); | ||
return ret; | ||
@@ -726,0 +727,0 @@ }, |
@@ -71,2 +71,7 @@ 'use strict'; | ||
* | ||
* Keys also cannot: | ||
* - be named after special properties `prototype`, `constructor`, and `__proto__` | ||
* - start with a dollar sign (`$`) | ||
* - contain any dots (`.`) | ||
* | ||
* #### Example: | ||
@@ -76,2 +81,4 @@ * | ||
* doc.myMap.set({ obj: 42 }, 42); // Throws "Mongoose maps only support string keys" | ||
* doc.myMap.set(10, 42); // Throws "Mongoose maps only support string keys" | ||
* doc.myMap.set("$test", 42); // Throws "Mongoose maps do not support keys that start with "$", got "$test"" | ||
* | ||
@@ -78,0 +85,0 @@ * @api public |
{ | ||
"name": "mongoose", | ||
"description": "Mongoose MongoDB ODM", | ||
"version": "8.5.2", | ||
"version": "8.5.3", | ||
"author": "Guillermo Rauch <guillermo@learnboost.com>", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"@babel/core": "7.24.7", | ||
"@babel/preset-env": "7.24.7", | ||
"@babel/preset-env": "7.25.3", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
@@ -53,3 +53,3 @@ "@typescript-eslint/parser": "^6.21.0", | ||
"fs-extra": "~11.2.0", | ||
"highlight.js": "11.9.0", | ||
"highlight.js": "11.10.0", | ||
"lodash.isequal": "4.5.0", | ||
@@ -60,3 +60,3 @@ "lodash.isequalwith": "4.4.0", | ||
"mkdirp": "^3.0.1", | ||
"mocha": "10.6.0", | ||
"mocha": "10.7.0", | ||
"moment": "2.30.1", | ||
@@ -71,5 +71,5 @@ "mongodb-memory-server": "10.0.0", | ||
"tsd": "0.31.1", | ||
"typescript": "5.5.3", | ||
"typescript": "5.5.4", | ||
"uuid": "10.0.0", | ||
"webpack": "5.92.1" | ||
"webpack": "5.93.0" | ||
}, | ||
@@ -76,0 +76,0 @@ "directories": { |
@@ -75,3 +75,3 @@ declare module 'mongoose' { | ||
/** The mongodb.Db instance, set when the connection is opened */ | ||
readonly db: mongodb.Db; | ||
readonly db: mongodb.Db | undefined; | ||
@@ -78,0 +78,0 @@ /** |
@@ -54,3 +54,3 @@ declare module 'mongoose' { | ||
*/ | ||
next(): Promise<DocType>; | ||
next(): Promise<DocType | null>; | ||
@@ -57,0 +57,0 @@ options: Options; |
@@ -160,4 +160,33 @@ /// <reference path="./aggregate.d.ts" /> | ||
>; | ||
export type HydratedSingleSubdocument<DocType, TOverrides = {}> = Types.Subdocument<unknown, Record<string, never>, DocType> & Require_id<DocType> & TOverrides; | ||
export type HydratedArraySubdocument<DocType, TOverrides = {}> = Types.ArraySubdocument<unknown, Record<string, never>, DocType> & Require_id<DocType> & TOverrides; | ||
export type HydratedSingleSubdocument< | ||
DocType, | ||
TOverrides = {} | ||
> = IfAny< | ||
DocType, | ||
any, | ||
TOverrides extends Record<string, never> ? | ||
Types.Subdocument<unknown, Record<string, never>, DocType> & Require_id<DocType> : | ||
IfAny< | ||
TOverrides, | ||
Types.Subdocument<unknown, Record<string, never>, DocType> & Require_id<DocType>, | ||
Types.Subdocument<unknown, Record<string, never>, DocType> & MergeType< | ||
Require_id<DocType>, | ||
TOverrides | ||
> | ||
> | ||
>; | ||
export type HydratedArraySubdocument<DocType, TOverrides = {}> = IfAny< | ||
DocType, | ||
any, | ||
TOverrides extends Record<string, never> ? | ||
Types.ArraySubdocument<unknown, Record<string, never>, DocType> & Require_id<DocType> : | ||
IfAny< | ||
TOverrides, | ||
Types.ArraySubdocument<unknown, Record<string, never>, DocType> & Require_id<DocType>, | ||
Types.ArraySubdocument<unknown, Record<string, never>, DocType> & MergeType< | ||
Require_id<DocType>, | ||
TOverrides | ||
> | ||
> | ||
>; | ||
@@ -164,0 +193,0 @@ export type HydratedDocumentFromSchema<TSchema extends Schema> = HydratedDocument< |
@@ -13,3 +13,3 @@ import { | ||
TSchemaOptions extends Record<any, any> = DefaultSchemaOptions | ||
> = { | ||
> = ApplySchemaOptions<{ | ||
[ | ||
@@ -19,3 +19,3 @@ K in keyof (RequiredPaths<DocDefinition, TSchemaOptions['typeKey']> & | ||
]: ObtainRawDocumentPathType<DocDefinition[K], TSchemaOptions['typeKey']>; | ||
}; | ||
}, TSchemaOptions>; | ||
@@ -22,0 +22,0 @@ /** |
@@ -77,10 +77,21 @@ import { | ||
type ResolveTimestamps<T, O> = O extends { timestamps: true } | ||
type ResolveTimestamps<T, O> = O extends { methods: any } | { statics: any } | { virtuals: any } | { timestamps?: false } ? T | ||
// For some reason, TypeScript sets all the document properties to unknown | ||
// if we use methods, statics, or virtuals. So avoid inferring timestamps | ||
// if any of these are set for now. See gh-12807 | ||
? O extends { methods: any } | { statics: any } | { virtuals: any } | ||
? T | ||
: { createdAt: NativeDate; updatedAt: NativeDate; } & T | ||
: T; | ||
: O extends { timestamps: infer TimestampOptions } ? TimestampOptions extends true | ||
? { createdAt: NativeDate; updatedAt: NativeDate; } & T | ||
: TimestampOptions extends SchemaTimestampsConfig | ||
? { | ||
-readonly [K in keyof Pick< | ||
TimestampOptions, | ||
'createdAt' | 'updatedAt' | ||
> as TimestampOptions[K] extends true | ||
? K | ||
: TimestampOptions[K] extends string | ||
? TimestampOptions[K] | ||
: never]: NativeDate; | ||
} & T | ||
: T | ||
: T; | ||
} | ||
@@ -87,0 +98,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2712642
51158
5