From af4f0e09135780c76d659a04637cfc5b1f1d87b1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 14 Nov 2016 14:01:47 +0100 Subject: [PATCH] =?UTF-8?q?DATAMONGO-1444=20-=20Accept=20Collection=20and?= =?UTF-8?q?=20subtypes=20in=20ReactiveMongoOperations.insertAll(=E2=80=A6)?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/mongodb/core/ReactiveMongoOperations.java | 6 +++--- .../data/mongodb/core/ReactiveMongoTemplate.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java index c7ff5066e..e99d05743 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java @@ -600,7 +600,7 @@ public interface ReactiveMongoOperations { * @param entityClass class that determines the collection to use * @return */ - Flux insertAll(Mono> batchToSave, Class entityClass); + Flux insertAll(Mono> batchToSave, Class entityClass); /** * Insert objects into the specified collection in a single batch write to the database. @@ -609,7 +609,7 @@ public interface ReactiveMongoOperations { * @param collectionName name of the collection to store the object in * @return */ - Flux insertAll(Mono> batchToSave, String collectionName); + Flux insertAll(Mono> batchToSave, String collectionName); /** * Insert a mixed Collection of objects into a database collection determining the collection name to use based on the @@ -618,7 +618,7 @@ public interface ReactiveMongoOperations { * @param objectsToSave the publisher which provides objects to save. * @return */ - Flux insertAll(Mono> objectsToSave); + Flux insertAll(Mono> objectsToSave); /** * Save the object to the collection for the entity type of the object to save. This will perform an insert if the diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java index 19f03d0d0..b3f9bc7aa 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java @@ -617,7 +617,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati return doFindOne(collectionName, new Document(idKey, id), null, entityClass); } - /* + /* * (non-Javadoc) * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#geoNear(org.springframework.data.mongodb.core.query.NearQuery, java.lang.Class) */ @@ -626,7 +626,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati return geoNear(near, entityClass, determineCollectionName(entityClass)); } - /* + /* * (non-Javadoc) * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#geoNear(org.springframework.data.mongodb.core.query.NearQuery, java.lang.Class, java.lang.String) */ @@ -769,7 +769,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(org.reactivestreams.Publisher, java.lang.Class) */ @Override - public Flux insertAll(Mono> batchToSave, Class entityClass) { + public Flux insertAll(Mono> batchToSave, Class entityClass) { return insertAll(batchToSave, determineCollectionName(entityClass)); } @@ -777,7 +777,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(org.reactivestreams.Publisher, java.lang.String) */ @Override - public Flux insertAll(Mono> batchToSave, String collectionName) { + public Flux insertAll(Mono> batchToSave, String collectionName) { return Flux.from(batchToSave).flatMap(collection -> insert(collection, collectionName)); } @@ -847,7 +847,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati * @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insertAll(org.reactivestreams.Publisher) */ @Override - public Flux insertAll(Mono> objectsToSave) { + public Flux insertAll(Mono> objectsToSave) { return Flux.from(objectsToSave).flatMap(this::insertAll); }