How to upsert doc with object into array or remove object from array

I have a document that includes an array of objects like the below sample. In my case it stores what menu items the user has access to. So what i am wondering how can i upsert the array menus with an new or existing object or remove an object from the array by ID ? currently i am doing it via SDK where i get subdoc then check if id in array and if not add it and on delete i check for index and then remove the item from array by index. I have the code below for the 3 functions update, delete and insert. The delete is straight forward and works not sure if need changes. The main issue is the upset / insert into array. Is there a way in N1QL with a single query to upsert into an array ? In my sample i do an array_append which does for sure not update and my update uses set based on i which will not work if i don’t exist. What i want to avoid is to have to check if the id exists in the menus array and then make another call to server to execute the update or insert. If there is no upsert for array, is there a way to combine the query if item exists with the conditional execution of insert or upsert in single query ?

{
  "_type": "user_menu",
  "_id": "46a67ecc-4a81-4b1c-8e8e-ea66c0463498",
  "user_id": "8D6D24A5-D669-45DC-99AC-F257BDA133A4",
  "menus": [
    {
      "id": "dbc2b568-2593-481e-9881-f092fa4952de",
      "hide": false
    },
    {
      "id": "F56AAC06-D2EB-4E1C-B84D-25F72973312E",
      "hide": false
    },
    {
      "id": "8FBA7B0B-566E-47CD-885B-1C08B57F34F6",
      "hide": false
    }
  ],
  "history": {
    "created_on": "2022-01-20T01:22:47.276Z",
    "creted_by": "8D6D24A5-D669-45DC-99AC-F257BDA133A4"
  }
}

Here is what i have for deliting the Object from Array so far

UPDATE Contacts c
SET c.menus = ARRAY e FOR e IN c.menus WHEN e.id <> "dbc2b568-2593-481e-9881-f092fa4952de" END
where c._type= "user_menu" AND c.user_id = "8D6D24A5-D669-45DC-99AC-F257BDA133A4"
AND ANY e IN c.menus SATISFIES e.id = "dbc2b568-2593-481e-9881-f092fa4952de" END;

In here is what i have for updating object in Array

UPDATE Contacts c
SET c.menus[i] = { "hide": true, "id": "F56AAC06-D2EB-4E1C-B84D-25F72973312E"} FOR i: mn IN c.menus WHEN mn.id = "F56AAC06-D2EB-4E1C-B84D-25F72973312E" END
where c._type= "user_menu" AND c.user_id = "8D6D24A5-D669-45DC-99AC-F257BDA133A4"

Here is my Insert into the Array Code

UPDATE Contacts c 
SET c.menus = ARRAY_APPEND (c.menus, { "hide": false, "id": "dbc2b568-2593-481e-9881-f092fa4952de"}) 
where c._type= "user_menu" AND c.user_id = "8D6D24A5-D669-45DC-99AC-F257BDA133A4"

Use CASE statement

UPDATE Contacts AS c
SET c.menus = CASE WHEN FIRST m FOR m IN c.menus WHEN m.id = "F56AAC06-D2EB-4E1C-B84D-25F72973312E" END IS NOT MISSING
                   TEHN ARRAY (CASE WHEN um.id = "F56AAC06-D2EB-4E1C-B84D-25F72973312E"
                               THEN OBJECT_PUT(um, "hide", true)
                               ELSE um END) FOR um IN c.menus END
                   ELSE ARRAY_APPEND(c.menus, {"hide": false, "id": "F56AAC06-D2EB-4E1C-B84D-25F72973312E"})
                   END
WHERE c._type= "user_menu" AND c.user_id = "8D6D24A5-D669-45DC-99AC-F257BDA133A4";