DATACOUCH-356 Fix cast issue in deleteAll (#201)

Plus a test.  I didn't notice that Douglas Six did basically the
same thing in another PR (this was a re-do of an earlier PR which
didn't quite do what we'd like).  So since I already had it done
and had a test, I closed that PR (#163) and added him to the author
list.

Also - repository.count() raises a NoSuchElementException after you
delete all the documents.  That seems like a bug, but we will deal
with that separately.
This commit is contained in:
David Kelly
2019-06-26 16:37:11 -06:00
committed by GitHub
parent 55235b2bc2
commit 64a91f1eb6
2 changed files with 98 additions and 3 deletions

View File

@@ -43,6 +43,8 @@ import reactor.core.publisher.Mono;
* @author Subhashni Balakrishnan
* @author Mark Paluch
* @author Christoph Strobl
* @author David Kelly
* @author Douglas Six
* @since 3.0
*/
public class SimpleReactiveCouchbaseRepository<T, ID extends Serializable> implements ReactiveCouchbaseRepository<T, ID> {
@@ -249,10 +251,9 @@ public class SimpleReactiveCouchbaseRepository<T, ID extends Serializable> imple
return mapMono(operations.queryView(query)
.map(AsyncViewResult::rows)
.flatMap(AsyncViewResult::rows)
.flatMap(row -> {
AsyncViewRow asyncViewRow = (AsyncViewRow) row;
return operations.remove(asyncViewRow.id())
return operations.remove(row.id())
.onErrorResumeNext(throwable -> {
if (throwable instanceof DocumentDoesNotExistException) {
return Observable.empty();