apoc.map.updateTree
Syntax |
|
||
Description |
Adds the data |
||
Arguments |
Name |
Type |
Description |
|
|
The map to be updated. |
|
|
|
The name of the key to match on. |
|
|
|
A list of pairs, where the first item is the value to match with the given key, and the second is a map to add to the tree. |
|
Returns |
|
Usage Examples
The following updates a nested map, adding additional key/values based on the value of the id
key:
RETURN apoc.map.updateTree({
id:1,
c:{
id:2
},
d:[
{id:3},
{id:4}
],
e: {notId: 5}
},'id',[
[1,{description: "Added where id=1"}],
[2,{description: "Added where id=2"}],
[3,{description: "Added where id=3"}],
[4,{description: "Added where id=4"}]
]) AS value;
Output |
---|
|