Please provide a working example of renaming existing node labels with apoc.refactor.rename.label procedure. I could not find any in the APOC guides.
Thanks
an example to create 10,000 nodes with label 'Label123' then display count of said nodes, rename the nodes to label 'Label456' using apoc.refactor.rename.label, display there counts
neo4j> foreach (x in range (1,10000) | create (n:Label123 {id:x}));
0 rows available after 921 ms, consumed after another 1 ms
Added 10000 nodes, Set 10000 properties, Added 10000 labels
neo4j> match (n:Label123) return count(n);
+----------+
| count(n) |
+----------+
| 10000 |
+----------+
neo4j> match (n:Label123) with collect(n) as nodes CALL apoc.refactor.rename.label('Label123','Label456',nodes) yield errorMessages as eMessages return eMessages;
+-----------+
| eMessages |
+-----------+
| {} |
+-----------+
neo4j> match (n:Label123) return count(n);
+----------+
| count(n) |
+----------+
| 0 |
+----------+
1 row available after 27 ms, consumed after another 0 ms
neo4j> match (n:Label456) return count(n);
+----------+
| count(n) |
+----------+
| 10000 |
+----------+
1 row available after 23 ms, consumed after another 0 ms
```
4 Likes
Thanks, it worked and could apply the change to 186555 nodes.