The delete() method deletes an item in
the database with the specified key. Delete operations are
synchronous only.
| API Call | object.delete(key [, casunique ] [, vbucket ]) | ||
| Asynchronous | no | ||
| Description | Delete a key/value | ||
| Returns | object; supported values: | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_KEY_ENOENT | Requested document ID does not exist | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_NOT_STORED | The object was not stored | ||
docid | Document ID of deleted document | ||
| Arguments | |||
key | Document ID used to identify the value | ||
int casunique | Unique value used to verify a key/value combination | ||
String vbucket | Name of the vBucket to be used for storage. | ||
For example, to delete an item you might use code similar to the following:
couchbase.delete("samplekey");