DATACOUCH-401 Fix incorrect return type for reactive string based N1ql count query

Motivation
----------
Reactive string based N1QL count query incorrectly returns the map after
the single result projection.

Changes
-------
Map the observable returning from the N1ql query result deserialized to
a map by converting to the correct return type using the conversion
service. Verified by integration tests.
This commit is contained in:
Subhashni Balakrishnan
2018-08-28 17:23:01 -07:00
parent 5fbfd78220
commit 5af4dae334
3 changed files with 25 additions and 6 deletions

View File

@@ -111,4 +111,16 @@ public class ReactiveN1qlCouchbaseRepositoryTests {
}
assertNotNull("Expected to find several parties", previousDesc);
}
@Test
public void testCustomSpelCountQuery() {
long count = partyRepository.countCustom().block();
assertEquals("Test N1QL Spel based query", 15, count);
}
@Test
public void testPartTreeQuery() {
long count = partyRepository.countAllByDescriptionNotNull().block();
assertEquals("Test N1QL part tree based query", 15, count);
}
}

View File

@@ -37,7 +37,7 @@ public interface ReactivePartyRepository extends ReactiveCouchbaseRepository<Par
@Query("SELECT count(*) + 5 FROM #{#n1ql.bucket} WHERE #{#n1ql.filter}")
Mono<Long> countCustomPlusFive();
@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter}")
@Query("SELECT count(*) FROM #{#n1ql.bucket} WHERE #{#n1ql.filter}")
Mono<Long> countCustom();
@Query("SELECT 1 = 1")