N1QL Update with ARRAY APPEND and missing Parent

Is there a param to tell N1QL to create a Parent if it does not exist. I use the below query to create a phone doc under my phones array, all works as expected if the doc has an phones array. if it does not have the phones array it fails to create the doc under pones

UPDATE mls SET phones = ARRAY_APPEND (phones, { "type":"home" , "number":"2135551212", "dflt":true }) where _type= "demo" and id= 123
I know in the subdoc operation there is a flag to create any missing parents hope that exists for N1QL as well

Hi @makeawish,
Please refer to
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/upsert.html

It is not clear based on doc that the UPSERT will apply to the Array or the actual DOC.

You need to use one of the conditional expressions, explained here:
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/condfununknown.html

This query will add an 8 to the end of the array in field “afield” if the field already exists, or create the field with with value [“8”] if the field does not exist:

update default use keys "foo" set afield = array_append(ifmissing(afield, []), 8)