Neo4j不建议使用节点ID存储在第三方系统中以供以后引用。
答案 0 :(得分:3)
确实,您不应在外部系统中引用内部ID,因为内部ID不稳定。
生成UUID的一个选项是使用apoc.create.uuid
中提供的apoc procedure library功能。例如:
CREATE (p:Person)
SET p.name = "Bob",
p.uuid = apoc.create.uuid()
有关用户定义的过程和函数的更多信息,请参阅this blog post。
答案 1 :(得分:1)
Another option is to to use GraphAware UUID to assign UUIDs to nodes and optionally relationships, transparently. It will also make sure that the UUIDs are not changed or deleted.
https://github.com/graphaware/neo4j-uuid
Disclaimer: I work at GraphAware
答案 2 :(得分:1)
现在Cypher具有randomUUID
本机功能,请参见https://neo4j.com/docs/cypher-manual/current/functions/scalar/