I need help querying AQL ArangoDB. I have a transaction data collection ( EventTran) that logs update data in its parent table ( Event). EventTranattributes include a timestamplink to the parent _id_event. Im trying to work out a request to return an array of only the first and last (through timestamp) EventTrandocuments for the specified one id_event. Here is an example:
FOR event IN EventTran
FILTER event._id_event == "Event/167697"
SORT event.timestamp DESC
RETURN event
May return:
[
{
"_key": "214092",
"_id": "EventTran/214092",
"_id_event": "Event/167697",
"timestamp": 1511202637
},
{
"_key": "213958",
"_id": "EventTran/213958",
"_id_event": "Event/167697",
"timestamp": 1511202542
},
{
"_key": "191809",
"_id": "EventTran/191809",
"_id_event": "Event/167697",
"timestamp": 1511118705
},
{
"_key": "167701",
"_id": "EventTran/167701",
"_id_event": "Event/167697",
"timestamp": 1510965562
}
]
I need a query that will return an array with only the first and last elements, i.e. the very first log entry and the very last log entry:
[
{
"_key": "214092",
"_id": "EventTran/214092",
"_id_event": "Event/167697",
"timestamp": 1511202637
},
{
"_key": "167701",
"_id": "EventTran/167701",
"_id_event": "Event/167697",
"timestamp": 1510965562
}
]
source
share