@ Override public BulkWriteResult execute ( final WriteBinding binding ) { return withReleasableConnection ( binding , new CallableWithConnectionAndSource < BulkWriteResult > ( ) { @ Override public BulkWriteResult call ( final ConnectionSource connectionSource , final Connection connection ) { validateWriteRequestsAndReleaseConnectionIfError ( connection ) ; if ( getWriteConcern ( ) . isAcknowledged ( ) || serverIsAtLeastVersionThreeDotSix ( connection . getDescription ( ) ) ) { BulkWriteBatch bulkWriteBatch = BulkWriteBatch . createBulkWriteBatch ( namespace , connectionSource . getServerDescription ( ) , connection . getDescription ( ) , ordered , writeConcern , bypassDocumentValidation , retryWrites , writeRequests , binding . getSessionContext ( ) ) ; return executeBulkWriteBatch ( binding , connection , bulkWriteBatch ) ; } else { return executeLegacyBatches ( connection ) ; } } } ) ; }
Executes a bulk write operation .