Salman
Salman
ATApache TinkerPop
Created by Salman on 12/16/2023 in #questions
Gremlin upsert on a vertex but preventing updates on a particular property on a vertex during upsert
Hi, Following is an upsert query on a vertex with label 'stvertex' and I am required to initialize and default the 'flagProp' to 0 only during creation of this vertex but during update I am required to prevent any update only on 'flagProp' while rest of the property should update, below is one of the approach I took: g.V(id).fold().coalesce(unfold(), __.addV(‘stvertex’) .property(T.id, id).property(Cardinality.single, flagProp,0)) .property(Cardinality.single, name, nameValue) .property(Cardinality.single, station, stationValue) .property(Cardinality.single, base, baseValue).next() The above query only works for creation of new vertex I am looking for some help to write the correct query which works for update as well
6 replies