1

我选择了一条路径,并希望从该路径返回带有标签的不同节点:

match path = ...
unwind(nodes(path)) as node
return distinct node { .*, type: labels(node)}

结果我得到

[{node={a:1, b:2, type=[t]}}, {node={a:3, b:4 type=[x]}}]

我想摆脱node文本并接收:

[{a:1, b:2, type=[t]}, {a:3, b:4 type=[x]}]

我怎样才能做到这一点?

neo4j 3.3.1 版: docker run --rm -p 7474:7474 --env=NEO4J_AUTH=none neo4j:3.3.1

4

1 回答 1

0

(更新:)您问题中的解决方案似乎工作正常。

match (node)
return distinct node { .*, type: labels(node) }
limit 1

最初,我建议使用该properties功能,但这会使事情变得不必要地复杂化:

match (node)
with node, properties(node) as props
return distinct props { .*, type: labels(node) }
limit 1
于 2018-01-11T12:05:24.540 回答