I have seen multiple examples of cypher FOREACH statements that reference the number 1 in square brackets and I cannot find documentation on it. This is a working statement:
FOREACH(i in CASE WHEN NOT rel IS NULL THEN [1] ELSE [] END |
DELETE rel CREATE (newest)-[:NEXT_SUB_REPLY]->(prevNewest))
and as happy as I am that it is working, I would like to understand more about the use of square brackets and the use of the number 1. From the context I understand that it loops through and when
CASE WHEN NOT rel IS NULL
is true, it executes
DELETE rel CREATE (newest)-[:NEXT_SUB_REPLY]->(prevNewest)
and otherwise it does nothing. The Neo4j docs are very light on FOREACH and don't go into either the use of square brackets or using a 1 in the THEN clause.