Hi,
I have a document like this:
{
"a": "1",
"b": [
{
"c": "IN"
},
{
"c": "OUT"
},
{
"c": "IN"
}
]
}
The array can have 1, 2, 3 or more object as part of b attribute. It will always have minimum one object. If it has just one element, then the value appended should be "e": "last"
I need a n1ql query which updates the json object in the b array with "e":"last"
and the previous elements with "e": "intermediate"
.
Something like this:
{
"a": "1",
"b": [
{
"c": "IN",
"e": "intermediate"
},
{
"c": "OUT",
"e": "intermediate"
},
{
"c": "IN",
"e": "last"
}
]
}
Thanks,
Himanshu