Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: .NET (C#) 1.1
Community Wiki and Resources
Wiki: .NET Client Library
Download Client Library
.NET Client Library
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
7 Update Operations
Chapter Sections
Chapters

7.4. Remove Methods

API Callobject.Remove(key)
Asynchronousno
Description Delete a key/value
ReturnsObject; supported values:
 COUCHBASE_ETMPFAILTemporary failure; try the operation again 
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 COUCHBASE_NOT_MY_VBUCKETThe command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation 
 COUCHBASE_NOT_STOREDThe object was not stored 
 docidDocument ID of deleted document 
Arguments 
string key Document ID used to identify the value

The Remove() method deletes an item in the database with the specified key.

Remove the item with a specified key

client.Remove("Budweiser");
API Callobject.ExecuteRemove(key)
Asynchronousno
Description Delete a key/value
ReturnsIRemoveOperationResult ( Remove operation result )
Arguments 
string key Document ID used to identify the value

The ExecuteRemove() method deletes an item in the database with the specified key and returns an instance of an IRemoveOperationResult.

var result = client.ExecuteRemove("Coors");

if (!result.Success) {
	if (result.InnerResult != null) {
		logger.Error(result.Message, result.InnerResult.Exception);
	}
}