How to add an entry in vertex with datatype of value Set in gremlin

408 Views Asked by At

I have tried below query

g.V(12345678).property("names",["Akshay"] as List)

It worked fine in my case. But I want value datatype to be a Set. Hence I tried below query.

g.V(12345678).property("names",["Akshay"] as Set)

But exception like this

Property value [[Akshay]] is of type class java.util.LinkedHashSet is not supported Display stack trace? [yN] n

Please tell me a way to save value datatype as Set

1

There are 1 best solutions below

1
Daniel Kuppitz On

Values need to be added one by one. If you only need to add one value, it's pretty easy:

g.V(12345678).property(set,"names","Akshay")

If you have a set of values to add, you can do something like this:

g.V(12345678).as("v").
  constant(["Akshay","Daniel"]).unfold().as("n").
  select("v").
    property(set,"names",select("n"))