How can I avoid duplicate insertion of edges #1193
-
How can I avoid duplicate insertion of edges in the code I have tried the code: QueryBuilder.insert().nodes().aliases("root").query(),
QueryBuilder.insert()
.nodes()
.values([[["id", 5]], [["id", 3]], [["id", 7]]])
.query(),
QueryBuilder.insert()
.edges()
.ids(
QueryBuilder.search()
.from("root")
.to(":1")
.where()
.edge()
.query(),
)
.from("root")
.to(":1")
.values_uniform([
{ key: { String: "type" }, value: { String: "out" } },
])
.query(); But it resulted in an error. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Your code is correct but there is a bug in the server (#1192) that causes the error. Firstly the form Secondly there is a bug in that replacing the
This might even be more correct then the path search because it would in fact return all of the edges and not just one of them. The result will be the same in your case though. |
Beta Was this translation helpful? Give feedback.
-
#1192 is now fixed so your original query should work now. Rebuild the server as usual. |
Beta Was this translation helpful? Give feedback.
Your code is correct but there is a bug in the server (#1192) that causes the error. Firstly the form
search().from().to()
does a path search meaning it will return only a single path, not all possible paths. It will still get a job done in this case because even if there is a single result the insert will just update that and if there is no path it will create them all. But it is worth noting it all the same.Secondly there is a bug in that replacing the
":1"
does not currently work withinids()
. I have opened #1192 and will get it fixed asap. As a workaround until the fix you can use: