We often see a pattern in Neo4j applications where a user wants to create one and only one relationship between two nodes. For example a User follows another User on a social network. We don’t want to accidentally create a second follows relationship because that may create errors such as duplicate entries on their feed, or errors unfollowing or blocking them, or even skew recommendation algorithms. Also it is just plain wasteful, and while an occasional duplicate relationship won’t be a big deal, millions of them could.
So how do we deal with this?