monkeyb
monkeyb

Reputation: 13

neo4j node id's and relationships

I'm relatively new to node, but went through the training tutorial and have been working heavily with it the past couple of weeks. My question is with regards to node id's and relationships.

I noticed that whenever I query Neo4j, the resultset never returns the node id's, is this on purpose? The reason I ask is when I try to relate records, I'm having to rely on other attributes to fetch the nodes in my MATCH clause so that I can later use them to build the relation.

After exhausting google, and noticing that the neo4j training tutorials never make use of the node id for anything and instead rely on other identifiers (e.g. movie title, actor name, etc), I've come to the conclusion/realization that perhaps this is by design, and it's the responsibility of the DBA to define his own identifiers (and index them) and not rely on the neo4j node id.

Am I correct in my assumptions?

Upvotes: 1

Views: 421

Answers (1)

tstorms
tstorms

Reputation: 5001

Neo4j does send back its node identifiers. If you want to explicitly fetch them in a RETURN clause, you can use id(your_node_alias). When a node gets deleted, its identifier can be re-used for another new node. Therefore it's never a good idea to rely on them. Creating and indexing your own unique identifier property is always a good idea.

Upvotes: 2

Related Questions