Search:

Search all manuals
Search this manual
Manual
Membase Client Library: Java
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
5 Membase Client Library: Java — Update Operations
Chapter Sections
Chapters

5.4. Delete Methods

The delete() method deletes an item in the database with the specified key. Delete operations are synchronous only.

API Callclient.delete(key)
Asynchronousyes
Description Delete a key/value
ReturnsOperationFuture<Boolean> ( Asynchronous request value, as Boolean )
Arguments 
String key Document ID used to identify the value

For example, to delete an item you might use code similar to the following:

Future<Boolean> success =
    membase.delete("samplekey");

try {
    if (success.get()) {
        System.out.printf("Delete succeeded\n");
    }
    else {
        System.out.printf("Delete failed\n");
    }

}
catch (Exception e) {
    System.out.println("Failed to delete " + e);
}