Neptune 在创建边缘时出现 gremlin 错误

Neptune with gremlin error when creating edge

我是海王星和图形数据库的新手,我试图在两个顶点之间创建一条简单的边,但遇到了一个我不完全理解的奇怪错误。

const user = await g.V().has('name', 'john').next()
const group = await g.addV("group").property("name", 'johns created group').next()
 const edge = await g.V(user).addE('memberOf').to(g.V(group)).next(); // this line causes error

第三行导致我得到以下错误

Error: The child traversal of ... was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal

对正在发生的事情或如何解决这个问题有什么想法吗?

在 TinkerPop 3.5.0 之后,您无法再从 g 生成子遍历。它必须从 __ 匿名生成,因此:

g.V(user).addE('memberOf').to(__.V(group))

有关 3.5.0 的 Upgrade Documentation 中可以找到更多信息。