I am trying to update the attribute on a json document in an embedded array using AQL. How do i update the \"addressline\" for \"home\" type address using AQL below?
<
ArangoDB now supports subset indexes. The following query is based on dothebarts answer:
FOR document IN complexCollection
FILTER document.subList[*].filterByMe == true LIMIT 1
UPDATE document WITH {
items: (
FOR element IN document.subList
RETURN element.filterByMe == true
? MERGE(element, { attributeToAlter: "the shiniest value"})
: element
)
} IN complexCollection
Note: Don't forget to create a hash
index on subList[*].filterByMe
:
db._collection('complexCollection')
.ensureIndex({type:'hash',fields:['subList[*].filterByMe']});