DELETE FROM defaut x USE KEYS "Store:30" UNNEST x.categories c UNNEST c.highlights h UNNEST h.plannings p WHERE c.categoryId="CATEGORIESERIES" AND h.highlightId="Highlight::21" AND p.planningId="p1"
Query Result:
[
{
"code": 3000,
"msg": "syntax error - at UNNEST",
"query_from_user": "DELETE FROM defaut x USE KEYS \"Store:30\" UNNEST x.categories c UNNEST c.highlights h UNNEST h.plannings p where c.categoryId=\"CATEGORIESERIES\" AND h.highlightId=\"Highlight::21\" AND p.planningId=\"p1\""
}
]
UPDATE default x
USE KEYS "Store::30"
SET h.plannings = ( ARRAY p FOR p IN h.plannings WHEN p.planningId <> "p1" END ) FOR h WITHIN categories WHEN h.plannings IS NOT NULL END;
I this exemple I want to delete The planning how have the id: Planning::1 and HighlightId: Highlight::3 and categoryId: Category::3 and StoreId Store::1
UPDATE default g USE KEYS "Store::1"
SET h.plannings = (ARRAY item for item IN h.plannings WHEN item.cbPlanningId <> "Planning::2" END)
WHERE g.categories = (ARRAY c for c IN g.categories WHEN c.categoryId = "Category::3" END) AND h.highlightId = "Highlight::3"
UPDATE default g USE KEYS "Store::1"
SET h.plannings = (ARRAY item for item IN h.plannings WHEN item.cbPlanningId <> "Planning::2" END)
FOR h WITHIN (ARRAY it for it IN g.categories WHEN it.categoryId = "Category::3" END) when h.highlightId = "h1" END;
@geraldss@a.u - how can we make sure N1QL is ACID complaint and there will not be a locking during race condition ? as I don’t see N1QL deal with CAS unlike CB Python API bucket operations
N1QL UPDATE full document mutation and check CAS value internally. Returns error if CAS mismatched and user can retry update operation. ACID is document level not statement level.