Remove and element from array and flatten it

I have a data structure something like
{
“_id”: [
“1234”,
“5678”
],
“id”: “docId”
}
In this document, I want to write a query to remove “1234” from Array.
I tried this query.
update sample as d use keys “docId”
set d._id=(select ARRAY_REMOVE(t._id, “1234”) as _id
FROM sample t
use keys “docId”);
But instead of updating existing _id array it is inserting an additional array. Something like this
{
“_id”: [
{
“_id”: [
“5678”
]
}
],
“id”: “docId”
}.
Please suggest what I am doing wrong!

Looks like this was answered on Stack Overflow

.