Delete entry in couchbase bucket using key in the form of regex

couchbase

Solution

The DELETE operation of the Couchbase doesn't support neither wildcards, nor regular expressions. So you have to get the list of keys somehow and pass it to the function. For example, you might use Couchbase Views or maintain your own list of keys via APPEND command. Like create the key `xyz` and append to its value all the matching keys during application lifetime with flushing this key after real delete request

Problem

I have a requirement wherein I have to delete an entry from the couchbase bucket. I use the delete method of the CouchbaseCient from my java application to which I pass the key. But in one particular case I dont have the entire key name but a part of it. So I thought that there would be a method that takes a matcher but I could not find one. Following is the actual key that is stored in the bucket ``` 123_xyz_havefun ``` and the part of the key that I have is xyz. I am not sure whether this can be done. Can anyone help.

Original source