Search code examples
orientdb

using UPSERT create edges but in vertex class it shows nothing in Orientdb


UPDATE GeoAgentSummary set out = #45:0, in = #21:0, _2015 = sum(_2015, 10.0f) upsert where out = #45:0 and in = #21:0

I am using the above query to either create an edge (if it is not there) or update an existing edge if it already exists in OrientDB

An edge is created between #45:0 and #21:0.

But in Agent(vertex class having clusters 45, 46, 47 and 48) i.e. in #45:0 it is not showing any outgoing edges.

Agent Class a vertex class


Solution

  • The UPDATE command acts like a normal document update without taking care of keeping the edge-vertex "synchronization". To do that you'd have to use the UPDATE EDGE that, however, doesn't support the UPSERT.

    There is on open issue on github about that https://github.com/orientechnologies/orientdb/issues/4436


    Read also this https://github.com/orientechnologies/orientdb/issues/1114