endNode()
returns the end node of a relationship.
Syntax: endNode(relationship)
Returns: A Node.
Arguments
Name | Description |
relationship | A numeric expression. |
Example
CREATE (:Person {name:"Elon Musk"})-[b:FATHER_OF]->(:Person {name:"X Æ A-12 Musk"})
RETURN endNode(b)
The value returned will be end-node of the relationship b. Which in this case will be-
{ "name": "X Æ A-12 Musk" }
Considerations
endNode(null)
returnsnull
.
Example
CREATE (:Person {name:"Elon Musk"})-[b:OWNS]->(:Company {name:"SpaceX"})
RETURN endNode(b)
Returns the following Result
endNode(b) |
{ "name": "SpaceX" } |
Example
CREATE (:Person {name:"Elon Musk"})-[b:OWNS]->(:Company {name:"SpaceX", founded:2002, venue:"California"})
RETURN endNode(b)
Returns the following Result
endNode(b) |
{ "name": "SpaceX", "founded": 2002, "venue": "California" } |
Example
CREATE (:Person {name:"Elon Musk"})-[b:OWNS]->(:Company)
RETURN endNode(b)
Returns the following Result
endNode(b) |
{ } |
Note– The end-node for the relationship b does not have any properties, and for that reason an empty map(representing a node) is returned.
Example
MATCH(:Person {name:"Elon Musk"})-[b:OWNS]->(:Company)
RETURN endNode(b)
This query is similar to the query above it, just that it searches for existing patterns in the databases instead of creating them. This query returns the following result, similar to the above query.
endNode(b) |
{ } |
Example
RETURN endNode(null)
Returns the following Result
endNode(null) |
null |