From e33a8befabdecf24a2eb3f49e0ae04dfe1ef21e1 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Mon, 20 Feb 2023 11:57:35 -0500 Subject: [PATCH] fix(types): add missing typedefs for bulkSave() to 5.x Fix #12019 --- index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.d.ts b/index.d.ts index 695fe60b3b4..f0e1e62b485 100644 --- a/index.d.ts +++ b/index.d.ts @@ -803,6 +803,13 @@ declare module 'mongoose' { bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions): Promise; bulkWrite(writes: Array, options?: mongodb.CollectionBulkWriteOptions, cb?: Callback): void; + /** + * Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than + * sending multiple `save()` calls because with `bulkSave()` there is only one + * network round trip to the MongoDB server. + */ + bulkSave(documents: Array): Promise; + /** Collection the model uses. */ collection: Collection;