override the value of existing property of a vertex or edge

172 views
Skip to first unread message

Ashwin Biyani

unread,
Jul 3, 2018, 9:00:58 AM7/3/18
to Gremlin-users
Hi,

When I give same property name and different value. it is getting added as new property instead of overriding old value. 

How do I override the value of a property?

Thanks,
Ashwin

Kelvin Lawrence

unread,
Jul 3, 2018, 11:38:16 AM7/3/18
to Gremlin-users
Hi Ashwin, I believe from your other posts that you are using Neptune. The default cardinality that Neptune uses is SET. So when you specify a new property value, by default, it will get added to the set of values for that property key (assuming the value is unique). To get the behavior you are looking for, i.e. to replace the property value, you just need to use the 'single' keyword. Here is an example:

g.V('1').property(single,'name','XYZ')

Hope this helps,
Kelvin

Ashwin Biyani

unread,
Jul 4, 2018, 5:35:04 AM7/4/18
to gremli...@googlegroups.com
Kelvin,

You are a **GOD** :). It works like a charm.

thanks very much

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/eb2d306e-a29b-4c42-b730-2ab3236ed350%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages