Description
The issue is that although the collection name (contact) is being used as the keyspace, the query_context of default:. is not being specified as an option.
Customer has a question on using #{#n1ql.delete} -- they're not getting the expected scope/collection in the generated N1QL. What are they doing wrong?
@repository
@scope("contacts")
@Collection("contact")
public interface ContactRepository extends CouchbaseRepository<Contact, String> {
@query("#{#n1ql.delete} WHERE status = $1 AND updateTime < $2 AND #{#n1ql.filter} LIMIT 1")
void deleteInactiveContacts(final ContactStatus status, final long updateTime);
}
com.couchbase.client.core.error.IndexFailureException: The server reported an issue with the underlying index {"completed":true,"coreId":"0x740bdb3700000001","errors":[{"code":12003,"message":"Keyspace not found in CB datastore: default:contact - cause: No bucket named contact"}],"idempotent":false,"lastDispatchedFrom":"y.y.y.y:49272","lastDispatchedTo":"x.x.x.x:8093","requestId":479,"requestType":"QueryRequest","retried":0,"service":{"operationId":"4ed7e8c5-a356-40c7-ab5b-77b0b9fafcca","statement":"DELETE FROM contact
WHERE status = $1 AND updateTime < $2 AND _class
= "com.xxx.Contact" LIMIT 1","type":"query"},"timeoutMs":75000,"timings":{"dispatchMicros":862708,"totalDispatchMicros":862708,"totalMicros":967676}}