Skip to content

Commit f746d5f

Browse files
authored
Count not requiring specific property name. (#1414)
Closes #1413.
1 parent c130084 commit f746d5f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/main/java/org/springframework/data/couchbase/core/ReactiveFindByQueryOperationSupport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ public Mono<Long> count() {
223223
} else {
224224
return throwable;
225225
}
226-
}).flatMapMany(ReactiveQueryResult::rowsAsObject).map(row -> {
227-
return row.getLong(TemplateUtils.SELECT_COUNT);
228-
}).next();
226+
}).flatMapMany(ReactiveQueryResult::rowsAsObject).map(row -> row.getLong(row.getNames().iterator().next()))
227+
.next();
229228
});
230229
}
231230

src/test/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryQueryIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void count() {
431431

432432
@Test
433433
void badCount() {
434-
assertThrows(CouchbaseQueryExecutionException.class, () -> airportRepository.countBad());
434+
assertThrows(NullPointerException.class, () -> airportRepository.countBad());
435435
}
436436

437437
@Test

0 commit comments

Comments
 (0)