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 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 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'] 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