I have a couchbase document with this structure stored in a bucket named dev_hostels:
{
"updatedAt": "2019-12-24T12:30:07.175Z",
"data": {
"type": {
"value": "n/a"
}
}
}
The n1ql update query
UPDATE `dev_hostels` set data.type.value = "GUEST_HOUSE", updatedAt = NOW_MILLIS() where meta().id = "HOSTEL:1";
or
UPDATE `dev_hostels` USE KEYS "HOSTEL:1" SET data.type.value = "GUEST_HOUSE", updatedAt = NOW_MILLIS() RETURNING meta().id;
but I got this error
"code": 3000,
"msg": "syntax error - at value",
value is a keyword, so you have to use escape it with backticks as well
UPDATE `dev_hostels` set data.type.`value` = "GUEST_HOUSE", updatedAt = NOW_MILLIS() where meta().id = "HOSTEL:1";