Skip to content

Increment

Description

This operation increments the value of the specified key by a specific number.

Method

Backendless.Hive(hiveName).MapStore(keyName).increment(key, count): 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.
count Specify the number to increment the value of the specified key.

Return Value

The incremented value.

Examples

Increment The Value By n + 1

The example below increments the value of the key 'Apples' by 1. When this operation is used without the count parameter, then the value is always incremented by 1 for every request made.

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

where:

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

Increment The Value By A Number

The example below increments the value of the key 'Apples' by 5.

await Backendless.Hive('groceryStore').MapStore('fruits').increment('Apples', 5)

where:

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

Codeless Reference

map_api_increment

where:

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

Returns the incremented value.

Consider the following Map storage:
map_apI_example_map_store_6

The example below increments the value of the key "Apples" by 5.

map_api_example_increment

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