Hey,
i am currently trying to convert a project to Spring/Couchbase and am having difficulty with the CrudRepository<?,?> Interface. I followed these posts and get the same problem as in my simplified test-case:
The auto-generated “findAll()” Method converts my ClassName vom “TestData” to “testdata” as the DesignDocument (lowercase)
The additionally added “findByDate” Method converts my ClassName vom “TestData” to “testData” as the DesignDocument (lowerCamelCase)
Thus the only way to not get an error is to define two DesignDocuments
_design/testdata -> “all” View
_desgin/testData -> “byDate” View
Tested with:
Version: 4.0.0-4051 Community Edition (build-4051)
spring-boot-starter-parent:
1.2.1.RELEASE (copy of the repo mentioned in the blog post)
1.3.2.RELEASE
1.3.3.BUILD-SNAPSHOT
1.4.0.BUILD-SNAPSHOT
I am probably missing something here?
This seems to be a rather easy to spot bug and should have haunted several people
@Bean
CommandLineRunner commandLineRunner(TestDataRepository repo, TestService service) {
return args -> {
repo.deleteAll();
TestData tu = new TestData("key", 0, 0);
repo.save(tu);
Iterable<TestData> findAll = repo.findAll();
Query query = new Query();
query.setIncludeDocs(true);
query.setStale(Stale.FALSE);
query.setRange("0", "999");
Collection<TestData> updates = repo.findByDate(query);
};
}