@@ -19,7 +19,11 @@ package com.mongodb
1919import org.bson.types.ObjectId
2020import spock.lang.Unroll
2121
22- import static com.mongodb.Fixture.*
22+ import static com.mongodb.Fixture.isReplicaSet
23+ import static com.mongodb.Fixture.isServerStartedWithJournalingDisabled
24+ import static com.mongodb.Fixture.isSharded
25+ import static com.mongodb.Fixture.isStandalone
26+ import static com.mongodb.Fixture.serverIsAtLeastVersion
2327import static com.mongodb.WriteRequest.Type.INSERT
2428import static com.mongodb.WriteRequest.Type.REMOVE
2529import static com.mongodb.WriteRequest.Type.REPLACE
@@ -363,6 +367,23 @@ class BulkWriteOperationSpecification extends FunctionalSpecification {
363367 collection. count() == 1
364368 }
365369
370+ def ' when two update documents together exceed 16MB, the documents are still updated' () {
371+ given :
372+ def operation = collection. initializeOrderedBulkOperation()
373+ operation. find(new BasicDBObject (' _id' , 1 ))
374+ .update(new BasicDBObject (' $set' , new BasicDBObject (' x' , new byte [1024 * 1024 * 8 ])));
375+ operation. find(new BasicDBObject (' _id' , 2 ))
376+ .update(new BasicDBObject (' $set' , new BasicDBObject (' x' , new byte [1024 * 1024 * 8 ])));
377+
378+ when :
379+ def result = operation. execute()
380+
381+ then :
382+ result == new AcknowledgedBulkWriteResult (UPDATE , 0 , expectedModifiedCount(0 ), [])
383+ collection. count() == 0
384+ }
385+
386+
366387 def ' should handle multi-length runs of ordered insert, update, replace, and remove' () {
367388 given :
368389 collection. insert(getTestInserts())
0 commit comments