DATAMONGO-2330 - Apply defaultWriteConcern for bulk operations.
Fixed regression introduced in DATAMONGO-1880. Original Pull Request: #775
This commit is contained in:
@@ -58,6 +58,7 @@ import com.mongodb.client.model.WriteModel;
|
|||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
|
* @author Michail Nikolaev
|
||||||
* @since 1.9
|
* @since 1.9
|
||||||
*/
|
*/
|
||||||
class DefaultBulkOperations implements BulkOperations {
|
class DefaultBulkOperations implements BulkOperations {
|
||||||
@@ -276,6 +277,10 @@ class DefaultBulkOperations implements BulkOperations {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
return mongoOperations.execute(collectionName, collection -> {
|
return mongoOperations.execute(collectionName, collection -> {
|
||||||
|
|
||||||
|
if (defaultWriteConcern != null) {
|
||||||
|
collection = collection.withWriteConcern(defaultWriteConcern);
|
||||||
|
}
|
||||||
return collection.bulkWrite(models.stream().map(this::mapWriteModel).collect(Collectors.toList()), bulkOptions);
|
return collection.bulkWrite(models.stream().map(this::mapWriteModel).collect(Collectors.toList()), bulkOptions);
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user