neo4j cypher,收集时返回字段而不是节点

时间:2014-02-10 04:29:40

标签: neo4j cypher

给出以下查询

match (a)-->(b)-->(c)
where id(a) = 0
return b.name, collect(c) as cs

如何才能返回仅由几个字段组成的集合,而不是整个节点?

2 个答案:

答案 0 :(得分:0)

单个字段很简单:

match (a)-->(b)-->(c)
where id(a) = 0
return b.name, collect(c.fieldName) as cs

对于多个字段名称,可能会将它们连接起来吗?

match (a)-->(b)-->(c)
where id(a) = 0
return b.name, collect(c.fieldName1 + delimiter + c.fieldName2) as cs

答案 1 :(得分:0)

match (a)-->(b)-->(c)
where id(a) = 0
return b.name, collect( { field1: c.field1, field2: c.field2 } ) as cs