Skip to content

Get Values

Description

This operation returns multiple key-value pairs for the specified key names.

Method

Backendless.Hive( hiveName ).KeyValueStore.get( keys ): Promise<object>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keys  An array of key names as strings identifying the key-value pairs.

Return Value

A JSON object containing the specified keys and the corresponding values. In case the specified keys do not exist, the operation returns an empty JSON object.

Example

Consider the following key-value store:

key-value-store

The example below retrieves values for the "USA" and "Japan" key names:

await Backendless.Hive( 'countries' ).KeyValueStore.get( ['USA', 'Japan'] )

where:

Argument                Description
'countries' Name of a hive where the operation is performed.
['USA', 'Japan']  Array containing key names to get the corresponding values for.

Response

{  
  "USA": "Washington DC",  
  "Japan": "Tokyo"  
}


Codeless Reference

keyvalue_api_get_values

where:

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

Returns key-value pairs for the specified keys.

Consider the following Key Value storage:

sample-key-value

The example below gets two key-value pairs for the specified keys ("USA" and "Japan"):

keyvalue_api_example_get_values
The output will look as shown below after the Codeless logic runs.
keyvalue_api_example_get_values_2