Mark, thank you for posting the article! very interesting.

One more question, say i create a unique constraint on :State(name)
So, theoretically i shouldnt get duplicates, however, what happens when i 
have the following query executed 2 times, simultaneously

MERGE (s:State {name: "Texas"})
CREATE UNIQUE s-[:city]->(c:City {name: "Houston"})

i would not want to create a unique constraint on :City(name), as obviously 
multiple cities, in different states, can have the same name,
however , i would want to make sure that "Texas" would not have 2 
"Houston"'s

how would this be accomplished?

On Monday, December 23, 2013 7:37:59 AM UTC-6, Mark Needham wrote:
>
> Hi,
>
> We were exploring a similar thing last week. I've written it up here - 
> http://www.markhneedham.com/blog/2013/12/23/neo4j-cypher-using-merge-with-schema-indexesconstraints/
>
> But as Michael says, unique constraint is the way to go for this type of 
> thing but once a Member is created with a specific id then merging on it 
> will not create a duplicate node even if you're only using a non-unique 
> index.
>
> Mark
>
> On Monday, 23 December 2013 01:00:34 UTC, Javad Karabi wrote:
>>
>> if i have 2 cypher query posts to neo4j
>>
>> "MERGE a:Member( {id: {member_id} })" , member_id: 5
>>
>> "MERGE a:Member( {id: {member_id} })" , member_id: 5
>>
>> with both of these posts occurring simultaneously, is it possible to have 
>> 2 nodes created, instead of just the one?
>> that is, if the first merge was interrupted halfway though, and had not 
>> completed yet, the second then creates a new one since it doesnt see the 
>> first...
>> is this something that could potentially happen?
>>
>> on a related note, how would i enforce uniqueness on Member(id) ?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to