I am attempting to remove multiple items from an array embedded in a document.
{
"id": "fooId",
"myArray": ["a","b","c"]
}
This works if I need to remove a single item"
UPDATEmyBucketSET myArray = ARRAY_REMOVE(myArray,"a") where meta(myBucket).id="fooId" RETURNING ARRAY_COUNT(myArray)
However, I’d like to remove multiple items doing something like this ARRAY_REMOVE(myArray,"a","b"). I’ve also tried ARRAY_REMOVE(myArray,["a","b"]) but neither work. The docs says that ARRAY_REMOVE:
returns a new array with all occurrences of the specified value(s) removed. It requires a minimum of two arguments…
This language implies that multiple items can be removed with a single command, though I am unable to get it to work.
That was the first thing I tried before posting here. I get this as an error message:
[
{
"code": 3000,
"msg": "Wrong number of arguments to function ARRAY_REMOVE. - at )",
"query_from_user": "UPDATE `myBucket` SET myArray = ARRAY_REMOVE(myArray,\"a\",\"b\") where meta(myBucket).id=\"fooId\" RETURNING ARRAY_COUNT(myArray)"
}
]
We are using Version: 4.5.0-2601 Community Edition (build-2601).