identity is an internal ID that is unique for every node and relationship in the graph. You can only retrieve this value with the id() function. Keep in mind that identity property values are reused so it is not a good idea to use them to identify a node or property unless you are ABSOLUTELY sure that the node or relationship will never be deleted.
I have no clue what the elementId is. What version Neo4j are you using? Our sandboxes used for our courses use V4.x of Neo4j.
The id() function uniquely names a node or relationship ID for a database.
The elementID() uniquely names a node or relationship ID for a DBMS (multiple databases) which is why id() is deprecated. elementID() is more useful in mult-database txns.
Hi. The release version I'm using is 5.2.0, and I'm running quires in the Neo4j Browser.
Here's a couple of dummy queries creating a node and relationships (please don't judge the second query I understand that it generates a Cartesian product each Foo to all Bar, it's only for demonstration). "elementId", "startNodeElementId" and "endNodeElementId" fields are highlighted.
Current documentation says that id() function you've mentioned is deprecated and there's another function with a similar description elementId()"returns a node or relationship identifier, unique within a specific transaction and DBMS".
>> Keep in mind that identity property values are reused so it is not a good idea to use them to identify a node or property unless you are ABSOLUTELY sure that the node or relationship will never be deleted.