Skip to content

Set Keys and Values

Description

This operation modifies values associated with one or more keys.  If the specified keys do not exist, new key-value pairs are created.

Method

Backendless.Hive(hiveName).KeyValueStore().multiSet(keyValues);

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyValues An object containing a mapping of keys and the corresponding values to be used as key-value pairs by the operation.

Return Value

None.

Example

The example below modifies values associated with the keys "Japan" and "USA". In case the keys do not exist, new key-value pairs are created.

// Creating the key-value map
Map<String, String> keyValues = new HashMap<>();
keyValues.put("Japan", "The land of the rising sun");
keyValues.put("USA", "The country of freedom");

// Invoking the multiSet method
Backendless.Hive("countries").KeyValueStore().multiSet(keyValues);

where:

Argument                Description
"countries" Name of a hive where the operation is performed.
"Japan","USA" Keys to update the values of. If the keys do not exist, new key-value pairs are created.
"The land of the rising sun","The country of freedom" Values to assign to the keys.

Codeless Reference

keyvalue_api_set_keys_and_values

where:

Argument                Description
hive name Name of a hive where the operation is performed.
keys/values object An object containing key names and corresponding values.

Consider the following Key Value storage:

sample-key-value

The following example sets key-value pairs:

keyvalue_api_example_set_keys_and_values


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