Skip to content

Commit 938c7ff

Browse files
committed
Added an explicit test for inserting > maxWriteBatchSize using the bulk API.
1 parent e950bbe commit 938c7ff

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/com/mongodb/BulkWriteOperationSpecification.groovy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,23 @@ class BulkWriteOperationSpecification extends FunctionalSpecification {
532532
ordered << [true, false]
533533
}
534534

535+
def 'should insert all documents when the number of inserts is larger than the match write batch size '(boolean ordered) {
536+
given:
537+
def operation = initializeBulkOperation(ordered)
538+
(0..1001).each {
539+
operation.insert(new BasicDBObject('_id', it))
540+
}
541+
542+
when:
543+
operation.execute()
544+
545+
then:
546+
collection.count == 1002
547+
548+
where:
549+
ordered << [true, false]
550+
}
551+
535552
def 'should throw correct BulkWriteException when the number of writes is larger than the match write batch size '(boolean ordered) {
536553
given:
537554
def operation = initializeBulkOperation(ordered)

0 commit comments

Comments
 (0)