spring-boot-data-r2dbc-jooq icon indicating copy to clipboard operation
spring-boot-data-r2dbc-jooq copied to clipboard

`fetchExists` is returning empty `Mono` instead of `Mono` containing `false`

Open GeorgiPetkov opened this issue 3 years ago • 1 comments

When a query yields records then fetchExists behaves as expected (returns Mono containing true). However, when there are no records fetchExists returns an empty Mono instead of Mono containing false.

In particular the code return fetchOne(existsQuery).map(Objects::nonNull) should be changed to return fetchOne(existsQuery).hasElement(). A Mono's element is never null so .map(Objects::nonNull) either does nothing (for empty Mono) or maps to true.

GeorgiPetkov avatar May 07 '21 10:05 GeorgiPetkov

Thanks for your report. We should fix this misbehaviour with your proposed change.

gofabian avatar May 09 '21 18:05 gofabian