Scofflaw
Scofflaw

Reputation: 152

Configuring apoc.refactor.MergeNodes()

I'm testing the apoc procedure on this set-up:

CREATE (:testNode{id:"1"})-[:TAGS{id:"r1"}]->(:tag{id:"h"})
CREATE (:testNode{id:"2"})-[:TAGS{id:"r2"}]->(:tag{id:"H"})

And then running this:

MATCH (htag:tag), (gtag:tag)
WHERE htag.id=toLower(gtag.id) AND htag<>gtag
WITH htag, gtag LIMIT 1
CALL apoc.refactor.mergeNodes([htag, gtag], {id:'discard'}) YIELD node
RETURN node

As I understand it, {id:'discard'} is supposed to indicate that if htag.id exists, it will be kept and gtag.id will be thrown out. Instead, it seems to be keeping gtag.id.

What am I misunderstanding?

Upvotes: 0

Views: 272

Answers (1)

stdob--
stdob--

Reputation: 29172

You incorrectly filled the config:

CALL apoc.refactor.mergeNodes([htag, gtag], {properties: {id:'discard'}}) YIELD node

[ https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_merging_nodes ]

Upvotes: 1

Related Questions