1
votes

I'm transitioning to ArangoDB for its power as a graph database and am struggling with the simple stuff.

If I have a document...

{ _id:'1234', tags:['apple','orange'] }

how can I update it to push or pull a value from the array? I would expect the syntax to be something like this, but didn't find anything in the docs...

collection.update({ _id:'1234' },{ tags:pull('mango') })
collection.update({ _id:'1234' },{ tags:push('avocado') })

Thank you!

1

1 Answers

1
votes

You achieve this with AQL. For example

FOR c in collection UPDATE c WITH { tags : PUSH(c.tags, 'avocado')} IN collection

https://docs.arangodb.com/3.3/AQL/Operations/Update.html