apoc.map.fromValuesFunctionDeprecated in Cypher 25
|
This function is deprecated. Use Cypher’s map comprehension instead. |
Syntax |
|
||
Description |
Creates a |
||
Arguments |
Name |
Type |
Description |
|
|
A list of keys and values listed pairwise to create a map from. |
|
Returns |
|
||
Usage examples
The following creates a MAP from alternating keys and values in a list:
apoc.map.fromValues
RETURN apoc.map.fromValues([
"name", "Cristiano Ronaldo",
"age", date("1985-02-05")
]) AS output;
Cypher’s Map Comprehension
WITH ["name", "Cristiano Ronaldo", "age", date("1985-02-05")] AS values
RETURN { i IN range(0, size(values) / 2, 2) | values[i]: values[i + 1] } AS output;
| output |
|---|
{
"name": "Cristiano Ronaldo",
"age": "1985-02-05"
}
|