1

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!

4

1 回答 1

1

您可以通过 AQL 实现这一目标。例如

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

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

于 2018-05-17T06:33:56.657 回答