I have nodes of label TypeA which have a string property, propA. propA is a string JSON and can be converted to a map using apoc.convert.fromJsonMap().
I want to create new nodes of TypeB, whose properties are propA and create a relationship between both nodes. I have run the following query succesfully:
MATCH (n:TypeA) WITH apoc.convert.fromJsonMap(n.propA) AS values,n limit 1 MERGE (v:TypeB) SET v=values WITH n,v MERGE (v)-[:RELATION_TYPE]->(n) RETURN v,n;
However when I use the following with apoc.periodic.iterate to convert my entire database, it throws an error. The query I running:
CALL apoc.periodic.iterate("MATCH (n:TypeA) RETURN n;", "WITH apoc.convert.fromJsonMap(n.propA) AS values,n MERGE (v:TypeB) SET v=values WITH n,v MERGE (v)-[:RELATION_TYPE]->(n) RETURN v,n;", {batchSize:10000, parallel: false});
The error:
{
"Expected ReferenceFromSlot(2) to be a map, but it was :`NO_VALUE`": 4382
}
Any help is greatly appreciated.