地图中的Neo4J还原
是否可以在密码查询中减少映射中的集合 例如:地图中的Neo4J还原,neo4j,cypher,reduce,reduction,Neo4j,Cypher,Reduce,Reduction,是否可以在密码查询中减少映射中的集合 例如: MATCH (n) WHERE n.foo =~ "ba[rz]" RETURN reduce({}, barz IN collect(n.foo) | {`(barz)`:[n]} ) 输入: [ {foo: 'bar'}, {foo: 'baz', some: 'thing'}, {foo: 'baz', or: 'other'} ] 输出: { bar: [ {foo: 'bar'}
MATCH (n) WHERE n.foo =~ "ba[rz]"
RETURN reduce({}, barz IN collect(n.foo) | {`(barz)`:[n]} )
输入:
[
{foo: 'bar'},
{foo: 'baz', some: 'thing'},
{foo: 'baz', or: 'other'}
]
输出:
{
bar: [
{foo: 'bar'}
],
baz: [
{foo: 'baz', some: 'thing'},
{foo: 'baz', or: 'other'}
]
}
不幸的是,现在还没有,最好是两个元素集合作为名称-值对(元组)。有一个group_by命令存在于其他语言中,在这里也可以使用