-1

I have written this gremlin query to update a property:

g.V("7cb57dad-d261-29cb-b886-affcd7442b73").property('tname', "updated tribename")

Is this the correct way to update a property in gremlin-node? Or do I have to pass in single property to update a property without adding additional value?

craigcaulfield
  • 3,381
  • 10
  • 32
  • 40

2 Answers2

1

If you want to replace the prior value then you need the single keyword to be explicitly specified as in:

g.V("7cb57dad-d261-29cb-b886-affcd7442b73").
  property(single, 'tname', "updated tribename")
Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
0

As Kelvin said you should use the single cardinality.

in gremlin-node you can import it like this:

const V_CARDINALITY = gremlin.process.cardinality;

g.V("7cb57dad-d261-29cb-b886-affcd7442b73").
  property(V_CARDINALITY.single, 'tname', "updated tribename")

noam621
  • 2,766
  • 1
  • 16
  • 26