Update query to add new array field and array_put to the new field

Hi All,

I tried below query to add a new field(which is array) and then used array_put to add value to it.
But its not adding new field and adding value to it.

Update mydoc use keys ["123456789"] 
SET contact.activeEmails = ARRAY_PUT(IFNULL(contact.activeEmails,OBJECT_ADD(contact, 'activeEmails',[])),"childKey123") 
FOR contact in mydoc.contactInfo
WHEN contact.roleId == "x" END

Thanks for your help
Narayan

UPDATE mydoc AS d USE KEYS ["123456789"]
SET contact.activeEmails = ARRAY_PUT(IFMISSINGORNULL(contact.activeEmails,[]),"childKey123")
    FOR contact IN d.contactInfo WHEN contact.roleId == "x" END
WHERE ANY v IN d.contactInfo SATISIFES v.roleId == "x" END;

Thanks @vsr1 , this worked.