我需要用他的和日期的列表Incidents
和他的嵌套events
有序 DESC进行查询。默认情况下,ReQL 以 ASC 顺序给出日期。我有以下结构:
startedAt
timestamp
{
"id": "87e14db8-1e15-4718-baac-f1c785e985cb" ,
"title": "Connection Error"
"startedAt": Mon Oct 26 2015 14:33:00 GMT+00:00 ,
"events": [{
"message": "Cannot connect to theserver.com",
"timestamp": Mon Oct 26 2015 14:33:00 GMT+00:00
},{
"message": "Cannot connect to theserver.com,"
"timestamp": Mon Oct 26 2015 14:33:20 GMT+00:00
},{
"message": "Cannot connect to theserver.com",
"timestamp": Mon Oct 26 2015 14:33:40 GMT+00:00
}]
},{
"id": "87e14db8-1e15-4718-baac-f1c785e985cb" ,
"title": "Other Connection Error"
"startedAt": Mon Oct 26 2015 14:34:20 GMT+00:00 ,
"events": [{
"message": "Connection rejected",
"timestamp": Mon Oct 26 2015 14:34:20 GMT+00:00
},{
"message": "Connection rejected",
"timestamp": Mon Oct 26 2015 14:34:41 GMT+00:00
}]
},{
... (several more)
}
如果我运行r.db('mydb').table('Incident').orderBy(r.desc('createdAt'))
,则事件createdAt
将按预期排序。但是嵌套events
的仍然是有序的 ASC。
如何进行查询以按时间戳获取具有 DESC 顺序的嵌套事件?