FOREACH ( i in range(0, 100) |
CALL apoc.create.node([$lables], $properties)
)
Problem: Invalid use of CALL inside FOREACH
Scenario: We are trying to create nodes with dynamic lables and range we are getting from user itself.
FOREACH ( i in range(0, 100) |
CALL apoc.create.node([$lables], $properties)
)
Problem: Invalid use of CALL inside FOREACH
Scenario: We are trying to create nodes with dynamic lables and range we are getting from user itself.
what version of Neo4j and APOC.
Also this at least works for me with Neo4j 4.4.14 / APOC 4.4.0.11 and via cypher-shell
@neo4j> create database proddb1;
0 rows
ready to start consuming query after 980 ms, results consumed after another 1 ms
@neo4j> :use proddb1
@proddb1> :param label=>["Person"]
@proddb1> :param properties => {name: "Tom Hanks"}
@proddb1> :params
:param label => ["Person"]
:param properties => {name: "Tom Hanks"}
@proddb1> unwind range (1,100) as i CALL apoc.create.node($label, $properties) yield node return count(*);
+----------+
| count(*) |
+----------+
| 100 |
+----------+
@proddb1> match (n:Person) return n limit 5;
+-------------------------------+
| n |
+-------------------------------+
| (:Person {name: "Tom Hanks"}) |
| (:Person {name: "Tom Hanks"}) |
| (:Person {name: "Tom Hanks"}) |
| (:Person {name: "Tom Hanks"}) |
| (:Person {name: "Tom Hanks"}) |
+-------------------------------+
5 rows
ready to start consuming query after 1 ms, results consumed after another 1 ms