是否可以在Cypher查询中减少Map中的Collection?
例如:
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'}
]
}