How do I ensure another request is not performing the same operation on
another node in the cluster?


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Marko Rodriguez
Sent: Thursday, July 07, 2011 10:35 AM
To: Neo4j user discussions
Subject: Re: [Neo4j] Unique Constaint on Index

Hi,

> We are testing Neo4J and need to support unique emails across all 
> users. Is this possible with the current API?

You can add such a constraint when updating the indices:

if(index.get('email', address).hasNext()) {
  throw new RuntimeException("There are two nodes that share the same email
address."); } else {
  index.put('email', address, node);
}

Marko.

http://markorodriguez.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to