I have a query that looks something like the following
g.V('9999').hasLabel('someLabel').
properties('PropertyName').
hasId('1234').
property('currentDate',12/12/2023).
property('previousDate',10/10/2023)`
Using this query when an Id matches the passed value on hasId the data needs to be updated. I’m able to update currentDate & previousDate, which is a meta property, on the following data, however I’d also like to update the ‘value’ field which is on the same level as the ‘id’ field. My question is how do I tweak the query to also update the value along with the Dates.
[
{
"id": "1234",
"value": "value",
"label": "PropertyName",
"properties": {
"currentDate": 12/12/2023,
"previousDate": 10/10/2023
}
}
]
I tried using Where or Find but it doesn’t seem to help or maybe I didn’t use it the right away
2
Answers
Thanks but it is a vertex with meta properties on it, like below
Now the provided solution is not working for the situation because instead of setting the value to "new-value" where id is '1234' instead it adds a new key-value pair as "value": "new-value" to it
The
element
step that was quite recently added to Gremlin would make this really easy. Given CosmosDB is using an old Gremlin version, perhaps you can try something like this:Alternatively, you could wrap part of the query with a
sideEffect
step. For example: