Couchbase N1QL查询以按其定制版本更新数组元素
发布数据时,我使用escapeCSV处理额外的逗号,但数据得到了一些额外的逗号/现在我想使用N1QL更新内容,但我被卡住了Couchbase N1QL查询以按其定制版本更新数组元素,couchbase,Couchbase,发布数据时,我使用escapeCSV处理额外的逗号,但数据得到了一些额外的逗号/现在我想使用N1QL更新内容,但我被卡住了 "School": [ { "address": "\"257 Shyam Nagar, Indore\"", "name": "National Convent" } Required:- "School": [ { "address": "257 Shyam Nagar, Indore"
"School": [
{
"address": "\"257 Shyam Nagar, Indore\"",
"name": "National Convent"
}
Required:-
"School": [
{
"address": "257 Shyam Nagar, Indore",
"name": "National Convent"
}
您需要在导入之前删除它们,N1QL需要一个有效的JSON。此外,还可以使用单引号:
INSERT INTO `test` ( KEY, VALUE )
VALUES
(
'mykey2',
{
'type': '"toy',
"attributes": {
'material': 'metal"',
'color': 'red""',
'weight': '200gr"',
'height': '5cm',
'width': '15cm'
}
}
使用替换功能
UPDATE default d
SET p.address = REPLACE(p.address, "\"","") FOR p IN d.School END
WHERE ...;
可以通过更新查询或应用任何其他可以使用的字符串函数来完成吗