title: Cypher QL doesn't execute atomically query
body: <p>I'm starting to work with Neo4j and I noticed a really bad behaviour when updating a property on a node I am reading at the same moment. The clojure code I wrote use Neocons library to communicate with Neo4j:</p>
  
  <pre><code>(ns ams.utils.t.test-cypher-error
    (:require [clojurewerkz.neocons.rest :as rest]
              [clojurewerkz.neocons.rest.nodes :as nodes]
              [clojurewerkz.neocons.rest.cypher :as cypher]))
  
  (rest/connect! "http://192.168.0.101:7474/db/data")
  
  (def counter-id (:id (nodes/create {:counter 0})))
  
  (defn update-counter [] (cypher/query "START c = node({id}) SET c.counter = c.counter + 1 RETURN c.counter as counter" {"id" counter-id}))
  
  (doall (apply pcalls (repeat 10 update-counter)))
  
  (println "Counter:" ((comp :counter :data) (nodes/get counter-id)))
  
  (nodes/destroy counter-id)
  </code></pre>
  
  <p>Guess the result:</p>
  
  <p><code>Counter: 4</code></p>
  
  <p>Sometimes is 5, sometimes 4, but you got the problem here: between the <code>START</code> and the <code>SET</code> clause the value of the counter is changed but cypher doesn't catch it!</p>
  
  <p>Two questions here:</p>
  
  <ul>
  <li>Am I doing something wrong?</li>
  <li>Is there any viable unique counter rest generation algorithm in Neo4j?</li>
  </ul>
  
  <p>Neo4j version is 1.9RC1, thanks in advance!</p>