From 3529c7d47f483ca2f6f8de9ba3049e97b0bada13 Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Fri, 5 Dec 2025 11:48:33 -0700 Subject: [PATCH 1/2] add nModified default --- driver/src/operation/bulk_write.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/driver/src/operation/bulk_write.rs b/driver/src/operation/bulk_write.rs index 60f78b77a..ccdadfab6 100644 --- a/driver/src/operation/bulk_write.rs +++ b/driver/src/operation/bulk_write.rs @@ -183,12 +183,8 @@ where result.add_insert_result(index, insert_result); } OperationType::Update => { - let modified_count = - n_modified.ok_or_else(|| ErrorKind::InvalidResponse { - message: "nModified value not returned for update bulkWrite \ - operation" - .into(), - })?; + // default to 0 as a workaround for SERVER-113026 + let modified_count = n_modified.unwrap_or(0); let update_result = UpdateResult { matched_count: n, modified_count, From 3a1f514b50de06c6ed6d8ffc2451cd0c7f76ae67 Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Fri, 5 Dec 2025 11:55:08 -0700 Subject: [PATCH 2/2] optimization --- driver/src/operation/bulk_write.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/driver/src/operation/bulk_write.rs b/driver/src/operation/bulk_write.rs index ccdadfab6..d4e5539b9 100644 --- a/driver/src/operation/bulk_write.rs +++ b/driver/src/operation/bulk_write.rs @@ -175,6 +175,12 @@ where n_modified, upserted, } => { + // small optimization for SERVER-113344: if the server unexpectedly returns a + // success response for an errors-only bulk write, skip deserializing the individual + // response, as the call to add_*_result will be a no-op + if R::errors_only() { + return Ok(()); + } let model = self.get_model(response.index)?; match model.operation_type() { OperationType::Insert => {