{
"customerId":"123456",
"events": [
{
"id":"9876",
"eventName":"Sample name of the event",
"eventDescription": "Sample name of the event with description"
}
]
}
Now I want to find all the events that match a list of IDs (which contains 1000s of values) and update the eventName and eventDescription fields of those by replacing Sample name with Sample name+
I came up with something like this, but I’m getting syntax error
UPDATE default
SET REPLACE(e.eventName, "Sample name" , "Sample name+")
FROM default UNNEST events e
WHERE e.id IN ["9876"]
UPDATE default AS d
SET e.eventName = REPLACE(e.eventName, "Sample name" , "Sample name+")
FOR e IN d.events WHEN e.id IN "9876"] END
WHERE ANY v IN d.events SATISFIES v.id IN ["9876"] END
UPDATE default AS d
SET e.eventName = REPLACE(e.eventName, "Sample name" , "Sample name+")
FOR e IN d.events WHEN e.id IN "9876"] END
WHERE ANY v IN d.events SATISFIES v.id IN ["9876"] END
You can update. Update with where clause ( if the new value is not present). Update with small batches with LIMIT (retry on errors) if needed use scan_plus.