This is my updated document when i execute query for first time the outcome is Result1 and again i execute query once again outcome is Result2.
Query:
UPDATE default AS d SET e.contact = ARRAY_APPEND(e.contact,{ "email": "[email protected]", "phone": 9876655555 }) FOR e IN d.details WHEN e.id = 1234 END WHERE META().id = "k01";
Result1:
"k01":
{
"details": [
{
"id": 1234,
"city": "Medway",
"country": "United Kingdom",
"name": "Medway Youth Hostel",
"url": "http://www.yha.org.uk",
"contact": [
{
"email": "[email protected]",
"phone": 6789435634
}
]
}]
}
Result 2:
"k01":
{
"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": 6789435634
}
]
}]
}
How can i control the duplicate values, When i execute the query for second time with same values.Everytime fields are inserting with same values irrespective of elements exists or not. please suggest me(Query). So that no duplicate appends will happen