{
"_id" : ObjectId("5e8dae610b209222e10a0ac4"),
"serial" : "2248",
"externalId" : "452085",
"hierarchyPathByIds" : ",5e2eb1662698a2097c71d855,",
"status" : "ACTIVE",
}
device_events collection {
{
"_id" : ObjectId("5e9d863a235721333eddfb81"),
"deviceId" : "5e8dae610b209222e10a0ac4",
"type" : "PACKAGE_TEST",
"createdAt" : ISODate("2020-04-20T11:04:27.943Z")
}
Note -> Have to fetch documents which have same device id in both collections if there is no any events with device collection, that would not be come as result. Device Events should filter for last hour and type as well. 1. Have to fetch all devices which is in device events created date descending order. 2. hierarchyPathByIds regex pattern match to '.,5e2eb1662698a2097c71d855,.'
Device has many device events.