How delete multiple documents from Couchbase server without query with Java SDK

Hello,

I am using the Couchbase server community version 7.0.2 and Java SDK 3.3.4, Not using query service on Couchbase server hence via query is not option for me.

I want to delete the multiple documents whose key match the provided prefix.

Currently I am using the below remove method which delete document exactly for provided key,

collection.async().remove(key);

but here I want to provide the some prefix of key and want to remove all the matching documents. I can’t see any such method on

com.couchbase.client.java.Collection

Could some one please help what could be solution for the same.

Hi @hgbalar
That is not possible with just KV service. I would be reaching for query service here, personally.

Use rangeScan prefix Data Operations | Couchbase Docs
with the options ScanOptions.scanOptions().idsOnly(true), and call remove() on the ids that are returned.

Agree that we can use the scan option but we are using server 7.0.2 and scan feature is only available 7.6 onward.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.