Skip to content

Delete Key

Description

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

Method

Backendless.Hive(hiveName).StoreType().delete(key);

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.
key A list containing one 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 list store.

List<String> key = new ArrayList<>();
key.add("fruits");

Backendless.Hive("groceryStore").ListStore().delete(key);

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