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

查看:26
本文介绍了我们应该使用 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 标识符是一个坏主意,因为它会随着时间的推移而改变.但是我认为当我们不使用此 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天全站免登陆