apoc.map.updateTree
Function
apoc.map.updateTree(tree Map<String, Any>, key String, data [[key Any, value Any]])
- adds the data map on each level of the nested tree, where the key-value pairs match.
Signature
apoc.map.updateTree(tree :: MAP?, key :: STRING?, data :: LIST? OF LIST? OF ANY?) :: (MAP?)
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 |
---|
|
Was this page helpful?