0
我有以下樣品JSONCouchbase N1ql查詢用於更新新客體到JSON數組
"address":{
"details":
[
{
"id" :<system generated UUID>,
"city" :{"type" : "string"},
"country" :{"type" : "string"},
"name" :{"type" : "string"},
"url" :{"type" : "string"},
"contacts" :
[{
"email":{"type" : "string"},
"phone":{"type" : "number"}
}]
}
]
}
我希望數據是通過以下方式 實施例1:
"address":
{
"details": [
{
"id": 1234,
"city": "Medway",
"country": "United Kingdom",
"name": "Medway Youth Hostel",
"url": "http://www.yha.org.uk"
}]
}
實施例2:
"address":
{
"details": [
{
"id": 1234,
"city": "Medway",
"country": "United Kingdom",
"name": "Medway Youth Hostel",
"url": "http://www.yha.org.uk",
"contact": [
{
"email": "[email protected]",
"phone": 6789435634
}
]
}]
}
實施例3:
"address":
{
"details": [
{
"id": 1234,
"city": "Medway",
"country": "United Kingdom",
"name": "Medway Youth Hostel",
"url": "http://www.yha.org.uk",
"contact": [
{
"email": "[email protected]",
"phone": 6789435634
},
{
"email": "[email protected]",
"phone": 9876655555
}
]
}]
}
例4:
"address":
{
"details": [
{
"id": 1234,
"city": "Medway",
"country": "United Kingdom",
"name": "Medway Youth Hostel",
"url": "http://www.yha.org.uk",
"contact": [
{
"email": "[email protected]",
"phone": 6789435634
}
]
},
{
"id": 3456,
"city": "Texas",
"country": "USA",
"name": "Texas Youth Hostel",
"url": "http://www.yha.org.uk",
"contact": [
{
"email": "[email protected]",
"phone": 876543219
}
]
}
]
}
我是很新的n1ql查詢,會有人請幫我找到插入溶液對象/更新數組對象用。示例1將數據插入JSON,示例2正在將數據更新爲示例1,並遵循... 1.請幫助獲取滿足上述示例的n1ql查詢。 2.如何在文檔
我怎樣才能控制重複值,當我執行query3每次字段插入相同的值,而不管元素是否存在或不存在。請建議我(查詢)。這樣就不會有重複的附件發生 – Raj