Update field with select result (using Merge?)

You need to have relation through document key as mentioned by @johan_larson, @keshav_m. You can include the relation and try it.

Other option is execute two independent queries and join through array.

CREATE INDEX ix1 ON bucket(name) WHERE _class = 'Intent';
UPDATE bucket a SET a.intentId =
FIRST v.id FOR v IN (SELECT meta(c).id, c.name FROM bucket c WHERE c._class = 'Intent') 
          WHEN  v.name=a.intent END
WHERE a._class= 'Journal';
2 Likes