From e894fe80aef26093374e83c7c132374da96ade25 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 2 Jan 2024 16:00:54 -0500 Subject: [PATCH] types: add `skipValidation`, `strict`, `timestamps` as options for bulkWrite() Fix #8778 --- index.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 26ccdd462db..705ac77ed9a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -777,6 +777,12 @@ declare module 'mongoose' { toDrop: Array } + interface MongooseBulkWriteOptions { + skipValidation?: boolean; + strict?: boolean; + timestamps?: boolean | 'throw'; + } + export const Model: Model; interface Model extends NodeJS.EventEmitter, AcceptsDiscriminator { new(doc?: AnyKeys & AnyObject): EnforceDocument; @@ -800,8 +806,8 @@ declare module 'mongoose' { * if you use `create()`) because with `bulkWrite()` there is only one round * trip to MongoDB. */ - bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions): Promise; - bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions, cb?: Callback): void; + bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions & MongooseBulkWriteOptions): Promise; + bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions & MongooseBulkWriteOptions, cb?: Callback): void; /** * Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than