0
votes

Given the following document structure:

{
  "active": "N",
  "code": "AL",
  "id": 3,
  "mcc": "+355",
  "name": "Arango",
  "participant": [
    {
      "actor": {
        "reference": "Patient/example",
        "display": "Peter James Chalmers"
      },
      "required": "required",
      "status": "not booked"
    }
  ]
}

I want to update array of participant[*].status as "not booked" to "booked".

could you tell me the Arango query for update array value.

1

1 Answers

0
votes

Here is a solution using an inline projection:

FOR doc IN coll
  FILTER doc._key == "<key>"
  UPDATE doc WITH {
    participant: doc.participant[* RETURN MERGE(CURRENT, {status: "booked"})]
  } IN coll

Note that this sets the status to "booked" for all objects in the participant array.