Мне нужно получить документы из коллекции с условием:
last_updated -gte ISODate("2020-02-26T22:1o:55.364Z")
Ввод имени коллекции: интенсивность_лог
Образцы документов :
[
{
junction_id:"J1",
intensities: [
{
lane_id: "L1",
data: [
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:15:55.364Z")
},
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:10:55.364Z")
},
{
intensity: 0.9,
last_updated: ISODate("2020-02-26T22:05:55.364Z")
}
]
},
{
lane_id: "L2",
data: [
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:15:55.364Z")
},
{
intensity: 2.1,
last_updated: ISODate("2020-02-26T22:10:55.364Z")
},
{
intensity: 1.1,
last_updated: ISODate("2020-02-26T22:05:55.364Z")
}
]
}
]
},
{
junction_id:"J2",
intensities: [
{
lane_id: "L1",
data: [
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:15:55.364Z")
},
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:10:55.364Z")
},
{
intensity: 0.9,
last_updated: ISODate("2020-02-26T22:05:55.364Z")
}
]
},
{
lane_id: "L2",
data: [
{
intensity: 1,
last_updated: ISODate("2020-02-26T22:15:55.364Z")
},
{
intensity: 2.1,
last_updated: ISODate("2020-02-26T22:10:55.364Z")
},
{
intensity: 1.1,
last_updated: ISODate("2020-02-26T22:05:55.364Z")
}
]
}
]
}
]
Ожидаемый результат:
[
{
junction_id: "J1",
data: [
{
lane_id: "L1",
sum: 2,
count: 2,
avg: 1
},
{
lane_id: "L2",
sum: 2,
count: 2,
avg: 1
}
]
},
{
junction_id: "J2",
data: [
{
lane_id: "L1",
sum: 2,
count: 2,
avg: 1
},
{
lane_id: "L2",
sum: 2,
count: 2,
avg: 1
}
]
}
]