apoc.node.id

Details

Syntax

apoc.node.id(node)

Description

Returns the id for the given virtual NODE.

Arguments

Name

Type

Description

node

NODE

The node to return the id from.

Returns

INTEGER

Usage Examples

The examples in this section are based on the following graph:

CREATE (s:Student {name: 'Alice', score: 71});
CREATE (s:Student {name: 'Mark', score: 95});
CREATE (s:Student {name: 'Andrea', score: 86});
CREATE (s:Student {name: 'Rajesh', score: 89});
CREATE (s:Student {name: 'Jennifer', score: 96});
CREATE (s:Student {name: 'Katarina', score: 80});

If we create virtual nodes containing students scores, we can use apoc.node.id to return the node id of those virtual nodes:

apoc.create.vNode Procedure
MATCH (s:Student)
CALL apoc.create.vNode(['Score'],{value: s.score})
YIELD node
RETURN node, apoc.node.id(node) AS nodeId;
Results
node nodeId

(:Score {value: 71})

-13

(:Score {value: 95})

-14

(:Score {value: 86})

-15

(:Score {value: 89})

-16

(:Score {value: 96})

-17

(:Score {value: 80})

-18