-
-
Save tareqabedrabbo/5639890 to your computer and use it in GitHub Desktop.
Neo4j optimistic locking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create n:Person {name: "Bob", updated: timestamp()} | |
return n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match n:Person | |
where n.name = "Bob" | |
and n.updated = 1369253063366 | |
set n.title = "The Bat", n.updated = timestamp() | |
return count(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create n:Person {name: "Fred", title: "The Cat", updated: timestamp()} | |
return n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match b:Person, f:Person | |
where b.name = "Bob" and f.name = "Fred" | |
and b.updated = 1369253064500 and f.updated = 1369254187545 | |
create b-[r:KNOWS]->f | |
set b.updated = timestamp(), f.updated = b.updated, r.updated = b.updated | |
return count(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"statements" : [ { | |
"statement" : "match b:Person where b.name ={name} and b.updated = {updated} set b.name = {new_name} return count(b)", | |
"parameters" : {"updated" : 1369254281895,"name" : "Bob","new_name": "bob" | |
} | |
} ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment