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"
}
}
}
that I try to update with this query
UPDATE `dev_hostels` set data.type.value = "GUEST_HOUSE", updatedAt = NOW_MILLIS() where meta().id = "HOSTEL:1";
but I got a 3000 Error
vsr1
2
UPDATE `dev_hostels` set data.type.`value` = "GUEST_HOUSE", updatedAt = NOW_MILLIS()
where meta().id = "HOSTEL:1";
value is reserve keyword https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/reservedwords.html
Use as escaped (with back-ticks) field. https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/identifiers.html
As you have document key. You should use following statement to avoid additional index lookup
UPDATE `dev_hostels` USE KEYS ["HOSTEL:1" ]
SET data.type.`value` = "GUEST_HOUSE", updatedAt = NOW_MILLIS() ;
1 Like