title: Cypher: How to match node based on property and then set or add new nodes accordingly?
body: <p>Suppose I have a nodes with properties <code>prop1</code> and <code>prop2</code>.</p>
  
  <p>I would like to add a new node according to the following logic:</p>
  
  <p>If a node <code>n</code> satisfies <code>n.prop1=123</code> then set <code>n.prop2=b</code> to be <code>789</code>;</p>
  
  <p>If no such node exists then add a <code>Node</code> with with <code>{prop1=123, prop2=789}</code>.</p>
  
  <p>The problem with doing something like <code>Merge (n:Node {prop1:123, prop2:789})</code> is that if some node <code>(m:Node {prop1:123, prop2:11111})</code> exists, for example, then we will end up with two nodes satisfying <code>prop1=123</code>.</p>
  
  <p>On the other hand, if I do <code>Match (n:Node) Where prop1=123 Set prop2=789</code> then this will do nothing if a no node with <code>prop1=123</code> exits.</p>
  
  <p>How can I accomplish this?</p>