Skip to content

Delete Keys

Description

This operation deletes multiple keys and the corresponding values from a Hive store.

Method

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

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.
keys Represents an array of keys that must be deleted from the specified store. Array of string values.

Return Value

The number of deleted keys. If no keys are deleted, then 0 is returned.

Example

The example below deletes the "fruits" and "vegetables" keys from the list store.

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

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

where:

Argument                Description
"groceryStore" Name of a hive where the operation is performed.
"fruits","vegetables" The array of keys to delete from the store.

Codeless Reference

general_api_delete_keys

where:

Argument                Description
hive name Name of a hive where the operation is performed.
type Storage type, can be one of the following: Key / Value, Sorted Set, Set, Map, List.
keys An array of key names (as string values) to delete.

Returns the number of deleted keys. If no keys are deleted, then 0 is returned.

Consider the following Key Value storage:

general_api_example_delete_value(s)_sample

The example below deletes two key-value pairs from the Key Value storage.

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