diff --git a/types/models.d.ts b/types/models.d.ts index 446a5c14da7..5166f47613f 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -106,7 +106,7 @@ declare module 'mongoose' { checkKeys?: boolean; j?: boolean; safe?: boolean | WriteConcern; - timestamps?: boolean; + timestamps?: boolean | QueryTimestampsConfig; validateBeforeSave?: boolean; validateModifiedOnly?: boolean; w?: number | string; diff --git a/types/query.d.ts b/types/query.d.ts index 5468cf68ec9..899ce9b29c6 100644 --- a/types/query.d.ts +++ b/types/query.d.ts @@ -90,6 +90,11 @@ declare module 'mongoose' { [key: string]: any; }; + interface QueryTimestampsConfig { + createdAt?: boolean; + updatedAt?: boolean; + } + interface QueryOptions extends PopulateOption, SessionOption { @@ -157,7 +162,7 @@ declare module 'mongoose' { * skip timestamps for this update. Note that this allows you to overwrite * timestamps. Does nothing if schema-level timestamps are not set. */ - timestamps?: boolean; + timestamps?: boolean | QueryTimestampsConfig; upsert?: boolean; writeConcern?: mongodb.WriteConcern;