Skip to content

Commit af4f0e0

Browse files
mp911deodrotbohm
authored andcommitted
DATAMONGO-1444 - Accept Collection and subtypes in ReactiveMongoOperations.insertAll(…).
1 parent 474af92 commit af4f0e0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ <T> Mono<T> findAndModify(Query query, Update update, FindAndModifyOptions optio
600600
* @param entityClass class that determines the collection to use
601601
* @return
602602
*/
603-
<T> Flux<T> insertAll(Mono<Collection<? extends T>> batchToSave, Class<?> entityClass);
603+
<T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> batchToSave, Class<?> entityClass);
604604

605605
/**
606606
* Insert objects into the specified collection in a single batch write to the database.
@@ -609,7 +609,7 @@ <T> Mono<T> findAndModify(Query query, Update update, FindAndModifyOptions optio
609609
* @param collectionName name of the collection to store the object in
610610
* @return
611611
*/
612-
<T> Flux<T> insertAll(Mono<Collection<? extends T>> batchToSave, String collectionName);
612+
<T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> batchToSave, String collectionName);
613613

614614
/**
615615
* Insert a mixed Collection of objects into a database collection determining the collection name to use based on the
@@ -618,7 +618,7 @@ <T> Mono<T> findAndModify(Query query, Update update, FindAndModifyOptions optio
618618
* @param objectsToSave the publisher which provides objects to save.
619619
* @return
620620
*/
621-
<T> Flux<T> insertAll(Mono<Collection<? extends T>> objectsToSave);
621+
<T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> objectsToSave);
622622

623623
/**
624624
* Save the object to the collection for the entity type of the object to save. This will perform an insert if the

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public <T> Mono<T> findById(Object id, Class<T> entityClass, String collectionNa
617617
return doFindOne(collectionName, new Document(idKey, id), null, entityClass);
618618
}
619619

620-
/*
620+
/*
621621
* (non-Javadoc)
622622
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#geoNear(org.springframework.data.mongodb.core.query.NearQuery, java.lang.Class)
623623
*/
@@ -626,7 +626,7 @@ public <T> Flux<GeoResult<T>> geoNear(NearQuery near, Class<T> entityClass) {
626626
return geoNear(near, entityClass, determineCollectionName(entityClass));
627627
}
628628

629-
/*
629+
/*
630630
* (non-Javadoc)
631631
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#geoNear(org.springframework.data.mongodb.core.query.NearQuery, java.lang.Class, java.lang.String)
632632
*/
@@ -769,15 +769,15 @@ public <T> Mono<T> insert(Mono<? extends T> objectToSave) {
769769
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(org.reactivestreams.Publisher, java.lang.Class)
770770
*/
771771
@Override
772-
public <T> Flux<T> insertAll(Mono<Collection<? extends T>> batchToSave, Class<?> entityClass) {
772+
public <T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> batchToSave, Class<?> entityClass) {
773773
return insertAll(batchToSave, determineCollectionName(entityClass));
774774
}
775775

776776
/* (non-Javadoc)
777777
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(org.reactivestreams.Publisher, java.lang.String)
778778
*/
779779
@Override
780-
public <T> Flux<T> insertAll(Mono<Collection<? extends T>> batchToSave, String collectionName) {
780+
public <T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> batchToSave, String collectionName) {
781781
return Flux.from(batchToSave).flatMap(collection -> insert(collection, collectionName));
782782
}
783783

@@ -847,7 +847,7 @@ public <T> Flux<T> insertAll(Collection<? extends T> objectsToSave) {
847847
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insertAll(org.reactivestreams.Publisher)
848848
*/
849849
@Override
850-
public <T> Flux<T> insertAll(Mono<Collection<? extends T>> objectsToSave) {
850+
public <T> Flux<T> insertAll(Mono<? extends Collection<? extends T>> objectsToSave) {
851851
return Flux.from(objectsToSave).flatMap(this::insertAll);
852852
}
853853

0 commit comments

Comments
 (0)