Need to delete / remove single Object from an array

I have Bucket called TY
When i use below query it’s delete everything from the array except “SecValue”.
Can, you check the query

UPDATE TY t
SET t.SupportArray= ARRAY_REMOVE (SupportArray, v.id = “GK315baf”)
WHERE ANY v IN SupportArray SATISFIES v.id=“GK315baf”
END;

{
“SecValue”: “02”,
“SupportArray”: [
{
“Rep”: “01”,
“RepDate”: “2019-09-10”,
“id”: “da315baf”
},
{
“Rep”: “01”,
“RepDate”: “2019-09-12”,
“id”: “GK315baf”
}
],
}

The scope of variable v only with in the ANY clause (ANY v IN t.SupportArray SATISFIES v.id = “GK315baf” END), outside it is not visible. So u can’t use in SET clause.

Use new ARRAY constructs.

UPDATE TY t
SET t.SupportArray =   ARRAY v1 FOR v1 IN t.SupportArray WHEN  v1.id != "GK315baf" END
WHERE ANY v IN t.SupportArray SATISFIES v.id = "GK315baf" END;

Can you please explain WHEN v1.id != “GK315baf” END this condition

“code”: 4000,
“msg”: “No index available on keyspace Notification that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.”

i have index on id

FOR v1 IN t.SupportArray takes every element of array
WHEN v1.id != “GK315baf” If condition is true then
append into new array of expression v1 ( i.e expression between ARRAY and FOR)
if condition is false ignores that element and moves to next element

ARRAY, FIRST, and OBJECT

Range transforms (ARRAY, FIRST, OBJECT) allow you to map and filter the elements or attributes of a collection or object(s). ARRAY evaluates to an array of the operand expression, while FIRST evaluates to a single element based on the operand expression. OBJECT evaluates to an object whose name : value attributes are name-expr : expr .

Name-expr must evaluate to a string. If not, that attribute is omitted from the result object.

range-xform:

You don’t have index.

You need following index or primary index

CREATE INDEX ix1 ON TY(DISTINCT ARRAY v.id FOR v IN SupportArray END);

Yes i have index in same way

UPDATE TY t
SET t.SupportArray = ARRAY v1
FOR v1 IN t.SupportArray
WHEN (v1.id != “GK315baf” END)
WHERE ANY v IN t.SupportArray SATISFIES v.id = “GK315baf” END;

“msg”: “syntax error - at END”,

Sorry, new to cb

CREATE INDEX idx_ns2_id ON TY((distinct (array (v.id) for v in SupportArray end)))
This my current index

CREATE INDEX idx_ns2_id ON TY((distinct (array (v.id) for v in SupportArray end)))
this is my current index

If Index is not using check Index is Built and provide the output of
select * from system:indexes where name = " idx_ns2_id";

   UPDATE TY t
    SET t.SupportArray = ARRAY v1 FOR v1 IN t.SupportArray WHEN (v1.id != "GK315baf") END
    WHERE ANY v IN t.SupportArray SATISFIES v.id = "GK315baf" END;

it’s returned the response but the query throw the same exception “code”: 4000,
“msg”: "No index available on keyspace TY that matches your query.
[
{
“indexes”: {
“datastore_id”: “”,
“id”: “764990bd37819c12”,
“index_key”: [
“(distinct (array (v.id) for v in SupportArray end))”
],
“keyspace_id”: “TY”,
“name”: “idx_ns2_id”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
}
]

It works for me. What is Couchbase version you are using.
If still has issue post screen shot of query and error

EXPLAIN UPDATE `TY` t
    SET t.SupportArray = ARRAY v1 FOR v1 IN t.SupportArray WHEN (v1.id != "GK315baf") END
    WHERE ANY v IN t.SupportArray SATISFIES v.id = "GK315baf" END;

it’s works now , thank you

Really appreciate your help