The issue I'm having is similar to this issue Cypher 'Node Already Exists' issue with MERGE, but it doesn't look like my constraint (id
) is being violated. Instead, I'm getting an error about another property which shouldn't be a constraint at all. I'm using apoc to connect to a mongo db and have verified that the mongo db is okay. This is my query:
CALL apoc.mongodb.get('mongodb://[HOSTNAME]:[PORT],'dbname','tablename',null,true) YIELD value as elt
MERGE (e:TableElements {id : elt.pid})
ON MATCH SET
e.symbol = elt.sym,
e.electron_cfg = elt.el
ON CREATE SET
e.atomic_number = elt.num,
e.symbol = elt.sym,
e.electron_cfg = elt.el,
e.atomic_weight = elt.weight,
e.name = elt.name;
And I'm getting this error:
Node(1) already exists with label `TableElements` and property `name` = 'HYDROGEN'
All issues with duplicate elements aside, how is it possible that I'm getting a constraint violation on a property that I haven't identified as a constraint? My understanding of MERGE is that it merges only on the properties specified in the merge clause which I think just consists of all nodes with property id
matching the incoming elt.pid
and I've already verified that there aren't any duplicate elt.pid
s, so I'm not sure what could be happening.