Skip to content

Delete Values

Description

This operation deletes specific elements from the set.

Method

// Delete One Value
Backendless.Hive(hiveName).SetStore(keyName).deleteValue(value): Promise<number>;

// Delete Multiple Values
Backendless.Hive(hiveName).SetStore(keyName).deleteValues(values[]): Promise<number>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a set. String value.
value A value to delete from the set. Value can be of any data type.
values  An array of values to delete from the set. Values can be of any data type.

Return Value

The number of deleted items. Otherwise, returns 0 if the specified values do not exist.

Example

Delete One Value

The example below deletes the 'Crossover' value from the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').deleteValue('Crossover')

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Delete Multiple Values

The example below deletes the 'Crossover' and 'Crossover' items from the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').deleteValues(['Sedan', 'Crossover'])

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Codeless Reference

set_api_delete_items

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a set.
items A list of items that must be deleted from the set.

Returns the number of deleted values.

Consider the following Set storage:
set_api_example_all_blocks

The example below deletes two items "Sedan" and "Crossover" from the "cars" set:
set_api_example_delete_items


The set will look as shown below after the Codeless logic runs:
set_api_example_special_blocks_2