我们应该使用Neo4J内部ID吗? [英] Should we use the Neo4J internal id?

查看:421
本文介绍了我们应该使用Neo4J内部ID吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用Neo4j数据库,我们需要某种ID来标识节点.

We are currently working with a Neo4j database, and we need some kind of id to identify nodes.

例如,我们具有CurrentUserHasAccess(NodeId)

For example we have functions like CurrentUserHasAccess(NodeId)

在其他Stackoverflow帖子中,我读到使用内部neo4j-identifier是个坏主意,因为它会随着时间而变化.但是,当我们不使用此ID链接数据时,我认为这不是问题.

On other Stackoverflow posts I read that it's a bad idea to use the internal neo4j-identifier, because it can change over time. However I think that's not an issue when we do not use this id to link data.

但是,我似乎找不到有关此主题的任何官方消息.

However I cannot seem to find any official sources about this topic.

我想使用此ID,因为这样我们就不必担心唯一性,而更重要的是索引.

I would like to use this ID because then we do not need to worry about uniqueness, and more importantly indexing.

推荐答案

很正确,通常不建议使用内部Neo4j节点ID.这主要是因为如果删除节点,则其原始内部ID可能会被回收/重用.如果您正在寻找一种快速,优雅的解决方案,请在此处查看GraphAware框架的UUID模块 https://github.com/graphaware/neo4j-uuid ,让我们知道它是否对您有用.

You are right that it is generally not recommended to use the internal Neo4j node IDs. This is mainly because if a node gets deleted, its original internal ID may get recycled/reused. If you're looking for a quick and elegant solution to this, have a look at the UUID module of the GraphAware Framework here https://github.com/graphaware/neo4j-uuid and let us know if it works for you.

这篇关于我们应该使用Neo4J内部ID吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆