IMForce
IMForce

Reputation: 37

How to add/remove attributes in a document before returning it in ArangoDB?

I am trying to query a document. Before I return the document, I need to delete some attributes like _id, _rev and add a few other calculated attributes. How can I achieve this?

Upvotes: 2

Views: 815

Answers (1)

darkheir
darkheir

Reputation: 8950

To remove some attributes you can use the UNSET functions:

FOR item in collection
    RETURN UNSET(item, "_id", "_key", "_rev")

Regarding calculating new attributes it mostly depends on what you want to achieve but there are a lot of available functions in AQL. If you give us a bit more details we could find what works for you!

Sources:

Upvotes: 4

Related Questions