I am trying to set properties on a vertex in a partitioned CosmosDB graph. If the vertex had any properties previously, I want them scrubbed and replaced with the new set of properties.
Even the deleting was a bit tricky, as the 'partition key' is exposed as a non-deleteable property.
g.V('nodeId').has('partitionKey','xx').properties().drop()
-> "Gremlin Query Execution Error: The partition property cannot be removed."
Fortunately, the id
of the partition key property is predictable and can be used for filtering it out:
g.V('nodeId').has('partitionKey','xx')
.properties().not(has('id', 'nodeId|partitionKey'))
.drop()
Now I'm stuck trying to add the new properties. I tried:
g.V('nodeId').has('partitionKey','xx')
.properties().not(has('id', 'nodeId|partitionKey'))
.drop()
.property('a','valA')
.property('b','valB')
but that looks like I'm applying the property()
step to a (empty) list of properties, not to a vertex.
The error isn't very helpful:
Gremlin Query Compilation Error: Column reference R_200324["_value"] cannot be located in the raw records in the current execution pipeline.
I tried using applying the property()
step to the vertex (by select
-ing it), but I must be doing something wrong:
g.V('nodeId').has('partitionKey','xx')
.as('v')
.properties().not(has('id', 'nodeId|partitionKey'))
.drop()
.select('v')
.property('a','valA')
.property('b','valB')
This gives the same error as above.
I also tried .back('v')
instead of .select('v')
but it looks like back
is not supported in CosmosDB.
Any suggestions?
back()
step in TinkerPop 3.x - that is old syntax from 2.x - stephen mallette