问题描述
我有两个节点 user
和 files
具有关系 :contains
,关系具有属性 id
这是一个数组,表示为
I have two nodes user
and files
with a relationship :contains
, the relationship has a property id
which is an array, represented as
(:user)-[:contains{id:[12345]}]->(:files)
但是我想用 1111
和 14567
连续 使用 值填充属性数组
查询,我没有找到任何将值推入数组的方法.id
Cypher
However I want to populate the property array id
with values 1111
and 14567
sequentially using Cypher
queries, I dont find any method to push values into the array.
将 1111 插入到属性 id
后,它将是:
After inserting 1111 to property id
it will be:
(:user)-[:contains{id:[12345,1111]}]->(:files)
将 14567 插入到属性 id
后,它将是:
After inserting 14567 to property id
it will be:
(:user)-[:contains{id:[12345,1111,14567]}]->(:files)
我不知道如何按顺序将值填充到属性数组中.
I don't know how to populate values to an property array sequentially.
推荐答案
向数组添加值类似于增加整数或连接字符串,并且以相同的方式表示,在您的情况下(让 c
成为你的 [c:contains {id:[12345]}]
)
Adding values to an array is analogous to incrementing an integer or concatenating a string and is signified the same way, in your case (let c
be your [c:contains {id:[12345]}]
)
c.id = c.id + 1111 // [12345,1111]
c.id = c.id + 14567 // [12345,1111,14567]
或
c.id = c.id + [1111,14567] // [12345,1111,14567]
这篇关于如何将值推送到 Cypher 中的属性数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!