0

We are using Spring Data Couchbase project and when trying to execute a existing view in production running into the below error

HTTP Status 500 - org.springframework.dao.InvalidDataAccessResourceUsageException: 
Could not load view "fooCount" for design doc "_design/foo"; 
nested exception is com.couchbase.client.protocol.views.InvalidViewException: 
Could not load view "fooCount" for design doc "_design/foo"

Below is our Spring Data Repository Definition

public interface FooRepository extends CrudRepository<Foo,String>{

       @View(designDocument="_design/foo",viewName="fooCount")
       public Long fooCount();

}

Can anyone provide an example of executing query using couchbase views? The documentation seems to be missing an example of doing it.

user1044173
  • 33
  • 1
  • 7
  • can you confirm which version of Spring Data Couchbase you are using? Also, the designDocument parameter of the annotation should omit the `_design/` prefix. – Simon Baslé Mar 23 '16 at 09:33

1 Answers1

-1

I found the answer:

1) Repository finder method name should start with "find" for ex. findFooByName.
2) A view name by "fooByName" must exist in production mode in Couchbase for it to execute successfully.

public interface FooRepository extends CrudRepository<Foo,String>{
       public List<Foo> findFooByName(Query query);
}
user1044173
  • 33
  • 1
  • 7
  • Sorry but I'm still confused by your answer. Do you use or not the @View annotation on your method ? If you do then does the name of the method matter ? – Stephane Dec 08 '15 at 08:40
  • Please consider adding more details to your answer – renke Nov 27 '18 at 16:30