apoc.map.updateTree函数
语法 |
|
||
描述 |
在嵌套树的每一层中,当键值对匹配时,添加数据 |
||
参数 |
名称 |
类型 |
描述 |
|
|
要更新的 Map。 |
|
|
|
用于匹配的键名。 |
|
|
|
一个列表对,其中第一项是与给定键匹配的值,第二项是要添加到树中的 map。 |
|
返回 |
|
||
使用示例
以下示例更新了一个嵌套 map,根据 id 键的值添加额外的键/值。
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;
| 输出 |
|---|
|