Skip to content

Decrement

Description

This operation decrements the key's value by a specific number.

Method

Backendless.Hive(hiveName).KeyValueStore(keyName).decrement(value): Promise<number>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a key-value pair. String value.
value A number to decrement the value of the key.

Return Value

Тhe decremented value.

Example

The example below decrements the value associated with the key 'John' by 2.

await Backendless.Hive('workedHours').KeyValueStore('John').decrement(2)

where:

Argument                Description
'workedHours' Name of a hive where the operation is performed.
'John' Key name to decrement the associated value by 2.

Codeless Reference

keyvalue_api_decrement

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a key-value pair.
decrement by Specify a number to decrement the value by.

Returns the decremented value.

Consider the following Key Value storage:

keyvalue_api_example_increment_decrement

The example below decrements the value for the "Apples" key by 2:

keyvalue_api_example_decrement


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