Skip to content

Get Specific Key-Values

Description

This operation retrieves specific key-value pairs from a map.

Method

Get One Key-Value Pair

Backendless.Hive(hiveName).MapStore(keyName).get(key): Promise<object>;

Get Specific Key-Value Pairs

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

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 in the map. String value.
keys An array containing key names to retrieve key-value pairs. Keys must be string values.

Return Value

An object containing key-value pairs retrieved from the map. Returns an empty JSON object if the specified keys do not exist.

Examples

Get One Key-Value Pair

The example below retrieves a key-value pair for the 'Oranges' key name:

await Backendless.Hive('groceryStore').MapStore('fruits').get('Oranges')

where:

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


Response Example:

{  
    "Oranges": 0.99  
}


Get Specific Key-Value Pairs

The example below retrieves two key-value pairs for the 'Oranges' and 'Apples' keys:

await Backendless.Hive('groceryStore').MapStore('fruits').get(['Oranges', 'Apples'])

where:

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

Response Example:

{  
    "Oranges": 0.99,  
    "Apples": 1.19  
}


Codeless Reference
map_api_get_specific_key_values

where:

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

Returns an object containing key-value pairs retrieved from the map.

Consider the following Map storage:
map_apI_example_map_store

The example below retrieves two key-value pairs for the "Oranges" and "Apples" keys from the "fruits" map.

map_api_example_get_specific_key_values

The logic produces the following output:

get-specific-key-values-result