AQL: document update of object embedded in array attribute

109 views
Skip to first unread message

Neptis rivularis

unread,
Jan 16, 2016, 6:48:49 PM1/16/16
to ArangoDB
Hi there !

I want to be able to change 'ext' attribute value of the 2nd items in the following object:

{
  "_id": "1234",
  "purpose": "tree",
  "items": [
    { "name": "list1", "ext": "alpha3" },
    { "name": "list2", "ext": "beta3" },
    { "name": "list3", "ext": "gamma3"
    }
  ],
  "gasp": {
    "ref": "creation1"
  }
}

I know there are AQL solutions using SLICE / MERGE  (  as shown here  https://github.com/arangodb/arangodb/issues/1633   )

but would it be possible, in a future version of ArangoDB,  to be able to write some more *simple*  AQL

maybe something like

FOR p in myCollection
FILTER p._key=='123'
UPDATE p.items[2] with {ext:"beta4"} in myCollection


Best regards,


Wilfried Gösgens

unread,
Jan 18, 2016, 5:23:54 AM1/18/16
to ArangoDB

Neptis rivularis

unread,
Jan 18, 2016, 6:02:47 AM1/18/16
to ArangoDB

Well..., What I would like to see is just a *simpler* solution for array atrributes...

In my opinion using MERGE / SPLICE etc is quite a complicated construct for what seems like a simple update.

Cheers,

JM

Wilfried Gösgens

unread,
Jan 18, 2016, 11:05:06 AM1/18/16
to ArangoDB
Yes, you're right.
While its possible, its not simple.
However, there currently are no resources to work on this.
Would you open a github issue so we don't forget this

Cheers,
Willi

Neptis rivularis

unread,
Jan 18, 2016, 2:44:49 PM1/18/16
to ArangoDB
Reply all
Reply to author
Forward
0 new messages