Update document type

Suppose i have document type :slight_smile:
“archive”:{
“id”:1,
“name”:“createor arch”,
type:“archive”
}

now i need to change the document type ,for example after updating my document will be
“hall_archive”:{
“id”:1,
“name”:“createor arch”,
type:“hall_archive”
}
How to run this update operation

UPDATE default AS d
SET d.type = "hall_archive"
WHERE d.type = "archive";

SELECT d AS hall_archive FROM default AS d
WHERE d.type = "hall_archive";

It works perfectly fine…But as we know that in couchbase document key is immutable.So how can we insert as new key and delete old one.

You can use INSERT INTO SELECT and then to insert and delete old one as separate statement.