Skip to content

Delete By Key Name

Description

This operation deletes a single or multiple key-value pairs from the map.

Method


Delete One Key-Value Pair

Backendless.Hive(hiveName).MapStore(keyName).deleteKeys(key): Promise<number>;

Delete Multiple Key-Value Pairs

Backendless.Hive(hiveName).MapStore(keyName).deleteKeys(keys[]): Promise<number>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a map. String value.
key Key name identifying a key-value pair. String value.
keys[] An array of key names to delete key-value pairs. String values.

Return Value

The number of deleted key-value pairs from the map.

Examples


Delete One Key-Value Pair

The example below deletes one key-value pair from the 'fruits' map that has the following key name 'Apples'.

await Backendless.Hive('groceryStore').MapStore('fruits').deleteKeys('Apples')

where:

Argument                Description
'groceryStore' Name of a hive where the operation is performed.
'fruits' Key name identifying a map.


Delete Multiple Key-Value Pairs

The example below deletes two key-value pairs from the 'fruits' map that have the following key names: 'Apples' and 'Oranges'.

await Backendless.Hive('groceryStore').MapStore('fruits').deleteKeys(['Apples', 'Oranges'])

where:

Argument                Description
'groceryStore' Name of a hive where the operation is performed.
'fruits' Key name identifying a map.


Codeless Reference
map_api_delete_keys

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a map.
object key names A list of key names identifying key-value pairs.

Returns the number of deleted key-value pairs from the map.

Consider the following Map storage:
map_apI_example_map_store

The example below deletes two key-value pairs "Oranges" and "Apples" from the "fruits" map.

map_api_example_delete_keys

The map will look as shown below after the Codeless logic runs:
map_apI_example_map_store_9