Reputation: 419
Why can't I use a create unique in a Merge ? Neo4j returns "unknown error "
Merge (o:Ot {name:"md2"} )
MERGE (pd:PD { p:"23"})
MERGE (tg:Ot {name:"XXX"})
MERGE (pi:PI { id:"123"})
WITH o,pi,target,pd
Create UNIQUE (o)-->(pi)-->(pd) , (pi)-->(tg)
RETURN o,pi,pd,tg
Upvotes: 0
Views: 46
Reputation: 66977
target
in your WITH
clause. It should probably be tg
.CREATE
a relationship between 2 nodes, you have to specify at least the relationship type.This query, for example, will work:
MERGE (o:Ot {name:"md2"})
MERGE (pd:PD { p:"23"})
MERGE (tg:Ot {name:"XXX"})
MERGE (pi:PI { id:"123"})
WITH o,pi,tg,pd
CREATE UNIQUE (o)-[:x]->(pi)-[:y]->(pd), (pi)-[:z]->(tg)
RETURN o,pi,pd,tg
Upvotes: 2