diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java index e6a8af30..09b61cb3 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java @@ -41,6 +41,7 @@ import reactor.core.publisher.Mono; * Reactive repository base implementation for Couchbase. * * @author Subhashni Balakrishnan + * @author Mark Paluch * @since 3.0 */ public class SimpleReactiveCouchbaseRepository implements ReactiveCouchbaseRepository { @@ -131,8 +132,8 @@ public class SimpleReactiveCouchbaseRepository imple @Override public Mono findOne(Mono mono) { Assert.notNull(mono, "The given mono must not be null!"); - return mono.then( - id -> findOne(id)); + return mono.flatMap( + this::findOne); } @SuppressWarnings("unchecked") @@ -145,8 +146,8 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override public Mono exists(Mono mono) { - return mono.then( - id -> exists(id)); + return mono.flatMap( + this::exists); } @SuppressWarnings("unchecked")