Spring data Couchbase #n1ql.fields query

I’m trying to make a N1QL based query on Spring Data Couchbase. The documentation says

n1ql fields will be replaced by the list of fields (eg. for a SELECT clause) necessary to reconstruct the entity.

My repository implementation is this one:

@Query("#{#n1ql.fields} WHERE #{#n1ql.filter}")
List<User> findAllByFields(String fields);

And I’m calling this query as follows:

this.userRepository.findAllByFields("SELECT firstName FROM default");

I’m getting this error:

Caused by: org.springframework.data.couchbase.core.CouchbaseQueryExecutionException: Unable to execute query due to the following n1ql errors: {“msg”:“syntax error - at AS”,“code”:3000}

Anyone knows how to do such a query?

Thank you in advance.

did you manage to solve the query because i am also getting similar error.