Get all Nodes that don't have a specific relationship in Neo4j
<p>I am trying to get all Nodes (node1) that have relationship (relationship of type R1) to node2 and not having (relationship of type R2).
I tried to run this query :</p>

<pre><code>MATCH  node1 -[r1: R1]-&gt; node2 WHERE node2.id = '1234' WITH node1,node2
OPTIONAL MATCH  node1- [r2: R2]-&gt;node2 WHERE r2 is NULL 
RETURN content 
</code></pre>

<p>I am stil getting nodes that have r2 relationship in the resulte.
what is wrong with my query?</p>