Skip to content

Delete Key

Description

This operation deletes a specific key and the corresponding value from a Hive store.

Method

[[[Backendless.shared hive:(NSString *)hiveName] storeType:(NSString *)keyName] deleteWithResponseHandler:^(void)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).storeType(keyName: String).delete(responseHandler: (() -> Void), errorHandler: ((Fault) -> Void)!)

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
storeType This placeholder must be substituted with one of the following stores types: keyValueStore, listStore, mapStore, setStore, sortedSetStore.
keyName Key name to delete. String value.

Return Value

1 if the specified key and the corresponding value are deleted. If the specified key is not deleted, then 0 is returned.

Example

The example below deletes the "fruits" key from the key-value store.

[[[Backendless.shared hive:(NSString *)hiveName] storeType:(NSString *)keyName] deleteWithResponseHandler:^(void)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).storeType(keyName: String).delete(responseHandler: (() -> Void), errorHandler: ((Fault) -> Void)!)

where:

Argument                Description
"groceryStore" Name of a hive where the operation is performed.
"fruits" Key name to delete from the store.

Codeless Reference

general_api_delete__key

where:

Argument                Description
hive name Name of a hive where the operation is performed.
type Type of the storage where to delete a key/value.
key name Key name to delete.

Returns 1 if the specified key and the corresponding value are deleted. If the operation is not successful, then 0 is returned.

Consider the following Key Value storage:

general_api_example_delete_value(s)_sample

The example below deletes the "Japan" key-value pair from the Key Value storage:

general_api_example_delete_key
The key-value storage will look as shown below after the Codeless logic runs:
general_api_example_delete_key_2