I am trying to get the first element of the object scan
. In my case, the first element's key
changes. So I cannot call it with the key
. Here is the AQL query I'm using, which is not working.
`FOR d in collection RETURN DISTINCT Object.keys(d.out.scan)[0]`
Object structure:
{
"out": {
"scan":{
"someKeyThatChanges":"someValue"
}
}
}
Is there a way to fetch the first key
of scan
?
Thank you
To fetch just the name of the first key of out.scan
, the following will work:
FOR d IN collection
RETURN ATTRIBUTES(d.out.scan)[0]
For returning the mapped value for that key, please refer to the other answer given.