diff --git a/types/aggregate.d.ts b/types/aggregate.d.ts index fa5ea6d99a4..7f5cdf062a4 100644 --- a/types/aggregate.d.ts +++ b/types/aggregate.d.ts @@ -4,7 +4,7 @@ declare module 'mongoose' { /** Extract generic type from Aggregate class */ type AggregateExtract

= P extends Aggregate ? T : never; - interface AggregateOptions extends Omit, SessionOption { + interface AggregateOptions extends Omit, SessionOption { [key: string]: any; } diff --git a/types/models.d.ts b/types/models.d.ts index 8b98d38563e..eb168e1913a 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -334,7 +334,7 @@ declare module 'mongoose' { /** Creates a `countDocuments` query: counts the number of documents that match `filter`. */ countDocuments( filter?: RootFilterQuery, - options?: (mongodb.CountOptions & MongooseBaseQueryOptions) | null + options?: (mongodb.CountOptions & MongooseBaseQueryOptions & mongodb.Abortable) | null ): QueryWithHelpers< number, THydratedDocumentType, @@ -469,7 +469,7 @@ declare module 'mongoose' { findOne( filter: RootFilterQuery, projection: ProjectionType | null | undefined, - options: QueryOptions & { lean: true } + options: QueryOptions & { lean: true } & mongodb.Abortable ): QueryWithHelpers< GetLeanResultType | null, ResultDoc, @@ -481,7 +481,7 @@ declare module 'mongoose' { findOne( filter?: RootFilterQuery, projection?: ProjectionType | null, - options?: QueryOptions | null + options?: QueryOptions & mongodb.Abortable | null ): QueryWithHelpers; findOne( filter?: RootFilterQuery, @@ -700,7 +700,7 @@ declare module 'mongoose' { find( filter: RootFilterQuery, projection: ProjectionType | null | undefined, - options: QueryOptions & { lean: true } + options: QueryOptions & { lean: true } & mongodb.Abortable ): QueryWithHelpers< GetLeanResultType, ResultDoc, @@ -712,7 +712,7 @@ declare module 'mongoose' { find( filter: RootFilterQuery, projection?: ProjectionType | null | undefined, - options?: QueryOptions | null | undefined + options?: QueryOptions & mongodb.Abortable | null | undefined ): QueryWithHelpers, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>; find( filter: RootFilterQuery,