2014-02-10 139 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