I'm trying to update a Couchbase doc from one structure to another here is the current structure
{
"config": {
"160x600": {
"siteId": "123455677"
},
"300x250": {
"siteId": "123455677"
},
"300x600": {
"siteId": "123455677"
}
}
}
Desired structure is
{
"config": {
"160x600": {
"siteId": "123455677",
"size":[160,600]
},
"300x250": {
"siteId": "123455677",
"size" : [300,250]
},
"300x600": {
"siteId": "123455677",
"size": [300,600]
}
}
}
Basically I wants to iterate over the keys inside config, split each key on 'x' and assign the resulting array as a value to "size" inside config[key].
Here is an N1QL query I tried (which obviously didn't work, hence this question here);
update AppBucket a set a.config[`size`].size = split(size, `x`) for size in OBJECT_NAMES(a.config) end
where meta(a).id like 'cnfg::40792';
Thanks in advance.