I need to do a match then set a value if condition satisfies and then return the node.
I have tried the following:
MATCH (n:node {uid: "myid"})
WHERE (NONE(x IN n.arr WHERE x = "newentry") SET n.arr = n.arr + "newentry")
RETURN n;
The problem with this statement is that it will not return the node if "newentry" already exists in n.arr. But at the same time, I only want to add the new entry if it does not exist in n.arr. Irrespective of whether new entry was added or not, I have to return the node if there is a match.
Please help me with this.