Skip to content

Delete Keys

Description

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

Method

Backendless.Hive(hiveName).[bucketType].delete(keys): Promise<number>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
[bucketType] This placeholder must be substituted with one of the following store types: KeyValueStore, ListStore, MapStore, SetStore, SortedSetStore.
keyName An array of key names to delete.

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' from the key-value store.

await Backendless.Hive('groceryStore').KeyValueStore.delete(['fruits', 'vegetables'])

where:

Argument                Description
'groceryStore' Name of a hive where the operation is performed.
['fruits','vegetables'] An array of key names 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 output will look as shown below after the Codeless logic runs.
general_api_example_check_if_keys_exist_2