amandeep1520
ATApache TinkerPop
•Created by amandeep1520 on 2/16/2024 in #questions
Adding multiple properties to a vertex using gremlin-go
Hello Community,
I have a question regarding how multiple properties can be added to a vertex using gremlin-go.
I did something like this
prop := map[string]interface{}{
"name": "Daniel",
"age": "37",
}
g.GetTraversal().Inject(prop).Unfold().As("M").AddV("Person").As("V").Select("M").Unfold().As("KV").Select("V").Property(
g.GetTraversal().V().HasLabel("Person").Select("KV").By(gremlingo.Column.Keys),
g.GetTraversal().V().HasLabel("Person").Select("KV").By(gremlingo.Column.Values),
).ToList()
This basically creates a new Person node with each property i.e. One person with name as Danier and other person with age as 37 whereas I want one person with both or more such properties to be created. Please let me know if there's any better way using gremlin-go.
I did try using gremlin and it works, so I need specific help here with Go
7 replies