Open BenjaBobs opened 6 years ago
@BenjaBobs which client driver are you using to execute these queries?
I'm using Microsoft.Azure.Graphs
and this is the case both for the emulator and CosmosDB in azure. Note that I haven't switched to the new Graph endpoint yet (don't know why I failed to mention this in the original post, as it seems relevant).
Microsoft.Azure.Graphs
has been deprecated, so you should switch to connecting to CosmosDB Gremlin Server (see gremlin endpoint for your CosmosDB Account) using Tinkerpop Gremlin.NET client. A tutorial + sample is available here.
Regardless, I was able to repro the issue in both cases (query 2 produces a slightly different error message) and it looks like there is a bug related to unfold() + nested traversal on has() operator. Will look into this further and determine a suitable workaround.
I'm trying to first gather up some information about whether the entities I want to do operations on exist and have the correct labels and such, and then save them and reuse them so as to save bandwidth. I made a small sample here with the issue I'm running in to.
Setup:
I then want to add edges from
'1'
to'2'
and'3'
if they all exist and the edges do not already exist.Query 1:
I store my entities as
entityToUpdate
,otherEntity
andthirdEntity
, and then reuse them both when checking if the edges already exist and when adding edges.Result:
The part checking if the edge already exists (
outE().inV().has('id', select('thirdEntity').unfold().id()
) does not seem to compare the correct ids. I then tried another method.Query 2:
I'm not sure why, but this yields an exception.
Result: