apoc.create.node
Syntax |
|
||
Description |
Creates a |
||
Input arguments |
Name |
Type |
Description |
|
|
The labels to assign to the new node. |
|
|
|
The properties to assign to the new node. |
|
Return arguments |
Name |
Type |
Description |
|
|
The created node. |
Creating a node with dynamic labels using Cypher
Labels can be referenced dynamically in Cypher without using APOC.
CREATE (n:$(label))
The dynamically calculated label must evaluate to a STRING
or LIST<STRING>
.
For more information, see the Cypher Manual → CREATE nodes and relationships using dynamic node labels and relationship types.
Usage Examples
The example below demonstrates how to use Cypher and APOC to create a node by passing in its labels and properties dynamically using a map:
The following creates labels
and properties
parameters:
:param labels => (["Human", "MovieStar"]);
:param properties => ({name: "Tom Cruise", placeOfBirth: "Syracuse, New York, United States"});
CALL apoc.create.node($labels, $properties);
CREATE (node:$($labels) $properties)
RETURN node;
node |
---|
(:Human:MovieStar {name: "Tom Cruise", placeOfBirth: "Syracuse, New York, United States"}) |