File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,12 @@ where
175175 n_modified,
176176 upserted,
177177 } => {
178+ // small optimization for SERVER-113344: if the server unexpectedly returns a
179+ // success response for an errors-only bulk write, skip deserializing the individual
180+ // response, as the call to add_*_result will be a no-op
181+ if R :: errors_only ( ) {
182+ return Ok ( ( ) ) ;
183+ }
178184 let model = self . get_model ( response. index ) ?;
179185 match model. operation_type ( ) {
180186 OperationType :: Insert => {
@@ -183,12 +189,8 @@ where
183189 result. add_insert_result ( index, insert_result) ;
184190 }
185191 OperationType :: Update => {
186- let modified_count =
187- n_modified. ok_or_else ( || ErrorKind :: InvalidResponse {
188- message : "nModified value not returned for update bulkWrite \
189- operation"
190- . into ( ) ,
191- } ) ?;
192+ // default to 0 as a workaround for SERVER-113026
193+ let modified_count = n_modified. unwrap_or ( 0 ) ;
192194 let update_result = UpdateResult {
193195 matched_count : n,
194196 modified_count,
You can’t perform that action at this time.
0 commit comments