Update on the same bucket with 2 docTypes


I am new to n1ql and trying to update existing document.
I have 2 docTypes in the same bucket.

1st document{
“docId”: “abc”,
“docType”: “test”,
“message”: “yes”
2nd document {
“docId”: “abc-def”,
“docType”: “test2”,
" docId" : “abc”

I want to update 2nd document under chat with message from 1st document if the docId matches with 1st document.

INSERT INTO default VALUES ("abc", { "docId": "abc", "docType": "test", "message": "yes" }),
                           ("abc-def",{ "docId": "abc-def", "docType": "test2", "chat":{ "docId" : "abc" } });
UPDATE default AS d SET d.chat.message = (SELECT RAW d2.message FROM default AS d2 USE KEYS d.chat.docId WHERE d2.docType = "test")[0]
WHERE d.docType = "test2" AND d.chat.docId IS NOT NULL;