1

I want to update the value of a property in all vertices of one label.

g.AddV('car').property('id','1').property('name','Benz')
g.AddV('car').property('id','2').property('name','BMW')
g.AddV('car').property('id','3').property('name','Audi')
g.AddV('car').property('id','4').property('name','Nissan')

Like that there are 1000s of vertices. I want to update the name value to lowercase in all those vertices. It needs to run on Azure Cosmos Graph DB.

MorKadosh
  • 5,846
  • 3
  • 25
  • 37
Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90

1 Answers1

0

Since gremlin doesn't have string manipulation functions.

And as far as I know, CosmosDb does not support lambda steps.

I think you will have to fetch all the names and ids:

g.V().has('name').project('id', 'name').by(id).by('name')

then lowercase every name in your code. and then update it like this:

g.V(id).property(single, 'name', lowercaseName)

Or all in one query:

g.inject(1).union(
.V(id1).property(single, 'name', lowercaseName1),
.V(id2).property(single, 'name', lowercaseName2)
.V(id3).property(single, 'name', lowercaseName3)
....
)

example: https://gremlify.com/pizsh5s293/1

noam621
  • 2,766
  • 1
  • 16
  • 26