apoc.agg.row

函数 Apoc 扩展

apoc.agg.row(element, predicate) - 返回匹配给定 predicate(谓词)的 element(元素)的索引。

签名

apoc.agg.row(value :: ANY, predicate :: STRING) :: LONG

输入参数

名称 类型 默认

ANY

null

predicate

STRING

null

用法示例

在谓词字符串参数中,我们必须使用参数 $curr 来检查当前元素。

假设有以下数据集

UNWIND [{date: datetime('1999'), other: 5}
    {date: datetime('2000'), other: 10},
    {date: datetime('2000'), other: 15} ] AS prop
CREATE (n:Date) SET n = prop;

我们可以执行

MATCH (n:Date)
RETURN apoc.agg.row(n, '$curr.date <> datetime("1999") AND $curr.other > 11 ') AS row
表 1. 结果
row

2

© . This site is unofficial and not affiliated with Neo4j, Inc.