apoc.convert.toNodeFunction
Syntax |
|
||
Description |
Converts the given value into a |
||
Arguments |
Name |
Type |
Description |
|
|
The value to convert into a node. |
|
Returns |
|
||
Example
Given this dataset:
CREATE (:Person {name: 'Alice'}), (:Person {name: 'Bob'})
The following query uses apoc.convert.toNode to cast a value extracted from a generic list back to a NODE:
MATCH (n:Person)
WITH collect(n) AS people
RETURN apoc.convert.toNode(people[0]) AS node
| node |
|---|
(:Person {name: "Alice"}) |
The function returns null when passed null or a value that is not a NODE:
RETURN apoc.convert.toNode(null) AS nullInput,
apoc.convert.toNode('not a node') AS wrongType
| nullInput | wrongType |
|---|---|
null |
null |