When using Spring Boot defaults with Couchbase, then Couchbase operations are affected by the ObjectMapper that gets configured by Spring Boot causing driver failures. Something like:

com.couchbase.client.core.error.CouchbaseException: query did not project __id. Either use #{#n1ql.selectEntity} or project __id and __cas : SELECT META(`travel-sample`).id AS __id, META(`travel-sample`).cas AS __cas, `name`, `iata`, `icao`, `callsign`, `country` FROM `travel-sample` WHERE `_class` = "example.springdata.couchbase.model.Airline"

Couchbase driver requires a specific Jackson Module to be registered that is shipped with the driver (com.couchbase.client.java.json.JsonValueModule) so that Couchbase's JsonObject and JsonArray can be used for JSON exchange.

I'd recommend improving the arrangement by registering JsonValueModule when Couchbase is on the classpath and when JacksonClusterEnvironmentBuilderCustomizer is used.

/cc @mikereiche

Comment From: wilkinsona

Thanks, Mark. Is there a relatively straightforward way in which we can reproduce the problem? When we fix this, it'd be good if we could add a test that verifies things work as expected. If it's too involved, we could just check that the module's been registered.

Comment From: mp911de

You need a running Couchbase server, you can run the Spring Data example at https://github.com/spring-projects/spring-data-examples/tree/main/couchbase/example (currently disabled because of the issue).