I need to find the minimum and maximum date from the list of dates. How can I do it? I use ravendb I do following:
from 'event' as e
where e.Header.Name in ('territory_entry', 'territory_exit')
and e.Payload.Id in ('123', '456')
select {
Lines: e.Lines.map(l => {
return {
maxTime: Math.max(e.Header.Timestamp)
}
})
}
But.. It doesn't work
For example, I have list of objects:
['123', territory_entry, '2022-04-06T12:31:13']
['123', territory_exit, '2022-04-06T13:31:13']
['123', territory_entry, '2022-04-06T14:31:13']
['456', territory_entry, '2022-04-06T12:31:13']
['456', territory_exit, '2022-04-06T13:31:13']
['456', territory_entry, '2022-04-06T14:31:13']
And all I need is return minimum entry by id and maximum entry by id query should return this:
min: ['123', territory_entry, '2022-04-06T12:31:13'], ['456', territory_entry, '2022-04-06T12:31:13']
max: ['123', territory_exit, '2022-04-06T13:31:13'], ['456', territory_exit, '2022-04-06T13:31:13']
rql doesn't have join etc, js functions don’t help me in this situation so I don't understand. Can someone help me, please?