apoc.agg.row
Function Apoc Extended
apoc.agg.row(element, predicate) - Returns index of the element
that match the given predicate
Usage Examples
In the predicate string parameter, we have to use the parameter $curr
to check the current element.
Given the following dataset:
UNWIND [{date: datetime('1999'), other: 5}
{date: datetime('2000'), other: 10},
{date: datetime('2000'), other: 15} ] AS prop
CREATE (n:Date) SET n = prop;
we can execute:
MATCH (n:Date)
RETURN apoc.agg.row(n, '$curr.date <> datetime("1999") AND $curr.other > 11 ') AS row
row |
---|
2 |