Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: Java 1.0
Community Wiki and Resources
Wiki: Java Client Library
Download Client Library
JavaDoc
Java Client Library
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
8 Update Operations
Chapter Sections
Chapters

8.4. Delete Methods

The delete() method deletes an item in the database with the specified key. Delete operations are asynchronous 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:

OperationFuture<Boolean> delOp =
    client.delete("samplekey");

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

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