Comparing version
@@ -1327,4 +1327,6 @@ 'use strict'; | ||
const wasForceClosed = typeof force === 'object' && force !== null ? force.force : force; | ||
for (const db of this.otherDbs) { | ||
this._destroyCalled ? db.destroy({ force: force, skipCloseClient: true }) : db.close({ force: force, skipCloseClient: true }); | ||
this._destroyCalled ? db.destroy({ force: wasForceClosed, skipCloseClient: true }) : db.close({ force: wasForceClosed, skipCloseClient: true }); | ||
} | ||
@@ -1331,0 +1333,0 @@ }; |
{ | ||
"name": "mongoose", | ||
"description": "Mongoose MongoDB ODM", | ||
"version": "8.16.3", | ||
"version": "8.16.4", | ||
"author": "Guillermo Rauch <guillermo@learnboost.com>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -48,4 +48,4 @@ declare module 'mongoose' { | ||
/** Checks if a path is set to its default. */ | ||
$isDefault(path: string): boolean; | ||
/** Checks if a path is set to its default. If no path set, checks if any path is set to its default. */ | ||
$isDefault(path?: string): boolean; | ||
@@ -52,0 +52,0 @@ /** Getter/setter, determines whether the document was removed or not. */ |
@@ -86,13 +86,13 @@ /// <reference path="./aggregate.d.ts" /> | ||
): Model< | ||
InferSchemaType<TSchema>, | ||
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>, | ||
ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'>, | ||
HydratedDocument< | ||
InferSchemaType<TSchema>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'> & ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>, | ||
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'> | ||
>, | ||
TSchema | ||
InferSchemaType<TSchema>, | ||
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>, | ||
ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'>, | ||
HydratedDocument< | ||
InferSchemaType<TSchema>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'> & ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>, | ||
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>, | ||
ObtainSchemaGeneric<TSchema, 'TVirtuals'> | ||
>, | ||
TSchema | ||
> & ObtainSchemaGeneric<TSchema, 'TStaticMethods'>; | ||
@@ -282,3 +282,19 @@ | ||
*/ | ||
constructor(definition?: SchemaDefinition<SchemaDefinitionType<RawDocType>, RawDocType, THydratedDocumentType> | DocType, options?: SchemaOptions<FlatRecord<DocType>, TInstanceMethods, TQueryHelpers, TStaticMethods, TVirtuals, THydratedDocumentType> | ResolveSchemaOptions<TSchemaOptions>); | ||
constructor( | ||
definition?: SchemaDefinition<SchemaDefinitionType<RawDocType>, RawDocType, THydratedDocumentType> | DocType, | ||
options?: SchemaOptions< | ||
FlatRecord<DocType>, | ||
TInstanceMethods, | ||
TQueryHelpers, | ||
TStaticMethods, | ||
TVirtuals, | ||
THydratedDocumentType, | ||
IfEquals< | ||
TModelType, | ||
Model<any, any, any, any>, | ||
Model<DocType, TQueryHelpers, TInstanceMethods, TVirtuals, THydratedDocumentType>, | ||
TModelType | ||
> | ||
> | ResolveSchemaOptions<TSchemaOptions> | ||
); | ||
@@ -285,0 +301,0 @@ /** Adds key path / schema type pairs to this schema. */ |
@@ -59,4 +59,4 @@ import { | ||
*/ | ||
type ObtainSchemaGeneric<TSchema, alias extends 'EnforcedDocType' | 'M' | 'TInstanceMethods' | 'TQueryHelpers' | 'TVirtuals' | 'TStaticMethods' | 'TSchemaOptions' | 'DocType'> = | ||
TSchema extends Schema<infer EnforcedDocType, infer M, infer TInstanceMethods, infer TQueryHelpers, infer TVirtuals, infer TStaticMethods, infer TSchemaOptions, infer DocType> | ||
type ObtainSchemaGeneric<TSchema, alias extends 'EnforcedDocType' | 'M' | 'TInstanceMethods' | 'TQueryHelpers' | 'TVirtuals' | 'TStaticMethods' | 'TSchemaOptions' | 'DocType' | 'THydratedDocumentType'> = | ||
TSchema extends Schema<infer EnforcedDocType, infer M, infer TInstanceMethods, infer TQueryHelpers, infer TVirtuals, infer TStaticMethods, infer TSchemaOptions, infer DocType, infer THydratedDocumentType> | ||
? { | ||
@@ -71,2 +71,3 @@ EnforcedDocType: EnforcedDocType; | ||
DocType: DocType; | ||
THydratedDocumentType: THydratedDocumentType; | ||
}[alias] | ||
@@ -112,3 +113,3 @@ : unknown; | ||
type IsPathRequired<P, TypeKey extends string = DefaultTypeKey> = | ||
P extends { required: true | [true, string | undefined] | { isRequired: true } } | ArrayConstructor | any[] | ||
P extends { required: true | string | [true, string | undefined] | { isRequired: true } } | ArrayConstructor | any[] | ||
? true | ||
@@ -209,3 +210,3 @@ : P extends { required: boolean } | ||
*/ | ||
type PathEnumOrString<T extends SchemaTypeOptions<string>['enum']> = T extends ReadonlyArray<infer E> ? E : T extends { values: any } ? PathEnumOrString<T['values']> : string; | ||
type PathEnumOrString<T extends SchemaTypeOptions<string>['enum']> = T extends ReadonlyArray<infer E> ? E : T extends { values: any } ? PathEnumOrString<T['values']> : T extends Record<string, infer V> ? V : string; | ||
@@ -212,0 +213,0 @@ type IsSchemaTypeFromBuiltinClass<T> = T extends (typeof String) |
@@ -19,3 +19,4 @@ declare module 'mongoose' { | ||
TVirtuals = {}, | ||
THydratedDocumentType = HydratedDocument<DocType, TInstanceMethods, QueryHelpers> | ||
THydratedDocumentType = HydratedDocument<DocType, TInstanceMethods, QueryHelpers>, | ||
TModelType = Model<DocType, QueryHelpers, TInstanceMethods, TVirtuals, THydratedDocumentType> | ||
> { | ||
@@ -223,4 +224,4 @@ /** | ||
{}, | ||
{ [name: string]: (this: Model<DocType>, ...args: any[]) => unknown }, | ||
AddThisParameter<TStaticMethods, Model<DocType>> | ||
{ [name: string]: (this: TModelType, ...args: any[]) => unknown }, | ||
AddThisParameter<TStaticMethods, TModelType> | ||
> | ||
@@ -227,0 +228,0 @@ |
Sorry, the diff of this file is too big to display
2572686
0.03%54700
0.03%