2014-02-10 131 views
0

时考虑以下查询Neo4j的暗号,收集

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

它怎么可能返回一个只有几个字段组成的集合,而不是整个节点返回区域,而不是节点?

回答

0
match (a)-->(b)-->(c) 
where id(a) = 0 
return b.name, collect({ field1: c.field1, field2: c.field2 }) as cs 
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 
+0

这并不回答前一个问题。 (也作为字段可以是大数组和地图,这就像简单的错误代码。) – Sovos

+0

你的问题是关于返回一组字段而不是节点 - 也许编辑更多的细节问题? – Luanne

+0

这个问题很清楚。您的答案根本不提供解决方案,只是一种解决方法。 – Sovos