UPDATE content SET categories = ARRAY a FOR a IN categories WHEN a != “veg” END
WHERE _type=“UserAsset” AND type IN [“IMAGE”,“AUDIO”,“VIDEO”,“SVG”,“FILE”,“PPT”] RETURNING categories
How to create a index for the above query… so that it will execute with in miliseconds ??
I have created index like
CREATE INDEX ix1d_UserAsset ON content(_type,type) WHERE (_type = “UserAsset”).
But its not working it seems.
CREATE INDEX ix1d_UserAsset ON content(type, DISTINCT ARRAY v FOR v IN categories END)
WHERE (_type = "UserAsset");
UPDATE content
SET categories = ARRAY a FOR a IN categories WHEN a != "veg" END
WHERE _type="UserAsset"
AND type IN ["IMAGE","AUDIO","VIDEO","SVG","FILE","PPT"]
AND ANY v IN categories SATISFIES v = "veg" END
RETURNING categories;
UPDATE requires whole document Fetch
mutation of document is controlled by WHERE clause. SET clause only decides what to set. If you have condition in set clause that can result in update same document with out any change. So you need to add that condition to WHERE clause avoid unnecessary mutation.