Delete keys that contain a string


I would like to delete all documents that their name ends with “UserID_2312”.
How can I do that and do I have to create some index for that? (my bucket is ephermal and I’m using community edition)


Ok I’ve found the answer.

I need a MOI index on the ‘id’ property of an Ephermal bucket but it’s not supported on community.
So all I can do is change the bucket type to Couchbase, create a GSI index and then use:

var queryRequest = new QueryRequest()
.Statement(“DELETE from " + bucketName + " where META(” + bucketName + “).id LIKE '%UserID_” + UserID + “’”);

var result = bucket.Query(queryRequest);