我正在使用 Spring 模块编写 couchbase 存储库,并且正在尝试使用 N1QL 查询添加我自己的 count 方法实现:
public interface MyRepository extends CouchbaseRepository<Entity, Long> {
@Query("SELECT count(*) FROM default")
long myCount();
}
但它不起作用:
org.springframework.data.couchbase.core.CouchbaseQueryExecutionException: Unable to retrieve enough metadata for N1QL to entity mapping, have you selected _ID and _CAS?
所以我的问题是:如何使用 spring-data-couchbase 编写计数查询?
我在春季文档中找不到任何关于此的内容。关联