Using AQL, is there a good way to get fields from a single document only if it exists?
E.g. say I've got a query like:
LET d = DOCUMENT("myCollection", "123")
RETURN { "name": d.name, "age": d.age }
If the document doesn't exist in the collection, this returns:
[
{
"name": null,
"size": null
}
]
However, this doesn't distinguish it from the case where the document does exist in the collection, but has both its fields set to null.
Is there a way of changing the above query so that the result is instead either just [] or null if the document isn't found? Or would I need to use two separate queries (one to check existence, then one to fetch the data if it does exist)?