Using array index to speed up update query

UPDATE `travel-sample`
SET v.utc = '10:13:01'
FOR v IN schedule WHEN v.flight = 'AF198' END
WHERE type = 'route' AND ANY v IN schedule SATISFIES  v.flight = 'AF198' END;

You need to eliminate the documents that doesn’t qualify through WHERE clause.

Example: if schedule doesn’t have flight = ‘AF198’ with out ANY condition the documents qualify for update and set value expression findings nothing qualifies to change this result in mutation without any value change and you want avoid this.

1 Like