I have a db with documents representing time-series measurements.
'valuesMin' can be in range 0->59 but there is no guarantee that all 60 values will be present.
{
"timeStampHour" : ISODate("2019-02-28T12:00:00.000Z"),
"valuesMin" : {
"0" : 20,
"1" : 20,
"2" : 22,
"3" : 23,
....
"54" : 32
}
}
{
"timeStampHour" : ISODate("2019-02-28T13:00:00.000Z"),
"valuesMin" : {
"5" : 20,
"10" : 25,
"14" : 27,
"15" : 30,
....
"59" : 40
}
}
How do I go about searching documents where any "valuesMin" field contains a value $gte 35?
Something along the lines of:
db.getCollection('sensorData').find({
'timeStampHour':{
$elemMatch:{'valuesMin.*':{$gte: 35}}
}
})
My search seems to show that true "*" wildcard is not doable, but is there a work around if I know that the keys are always between '0' and '59'?