2
votes

I would like to do something like

MERGE (c:C {p1: 123})
WHERE p2 IS NULL
RETURN c

i.e., try to match a node with label C with value 123 for property p1 and with property p2 not set. And while that syntax is okay if I use MATCH instead of MERGE, the way it's written it doesn't work. Is there another way to write it to make it work?

1

1 Answers

2
votes

You could do that using WITH keyword:

MERGE (c:C {p1: 123})
WITH c WHERE c.p2 IS NULL
RETURN c

Below WITH statement you will have only C's that have p1 = 123 and no p2 whether they matched or created.