Closed
Description
Hello,
I'm using the 4.4.2 version
Running a query with custom n1ql hints fails as the bucket is wrongly replaced by the collection name.
Configuration :
@Configuration
@EnableReactiveCouchbaseRepositories
class CouchbaseConfig(
private val properties: CouchbaseProperties
) : AbstractCouchbaseConfiguration() {
override fun getConnectionString(): String {
return properties.connectionString
}
override fun getUserName(): String {
return properties.username
}
override fun getPassword(): String {
return properties.password
}
override fun getBucketName(): String {
return "test"
}
}
Repository :
interface ScheduleRepository : ReactiveCouchbaseRepository<Schedule, String> {
@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter}")
fun findByN1ql(): Flux<Schedule>
@Query("SELECT c.* FROM #{#n1ql.bucket}.#{#n1ql.scope}.#{#n1ql.collection} c WHERE c.#{#n1ql.filter}")
fun findByN1qlCustom(): Flux<Schedule>
}
Running the findByN1ql
query runs fine, n1ql.selectEntity fetches data in the correct bucket/scope/collection
However, running the custom query findByN1qlCustom
which specifies bucket/scope/collection doesn't work :
com.couchbase.client.core.error.IndexFailureException: The server reported an issue with the underlying index {"completed":true,"coreId":"0xe4295ea200000001","errors":[{"code":12003,"message":"Keyspace not found in CB datastore: default:schedule - cause: No bucket named schedule","retry":false}],"httpStatus":500,"idempotent":false,"lastDispatchedFrom":"127.0.0.1:55070","lastDispatchedTo":"127.0.0.1:8093","requestId":179,"requestType":"QueryRequest","retried":0,"service":{"bucket":"test","operationId":"d319c5bb-28b3-4b22-a38c-2be2d0a3a290","scope":"dev","statement":"SELECT c.* FROM `schedule`.`dev`.`schedule` c WHERE `_class` = \"com.rbleuse.spring.reactive.couchbase.model.Schedule\"","type":"query"},"timeoutMs":75000,"timings":{"dispatchMicros":27475,"totalDispatchMicros":27475,"totalMicros":33870}}
No bucket named schedule