I have a JSON document stored in mongodb where a sub-document is date-time-stamp. I need to query and filter sub-documents between a date range.
I am using mongo shell to play around with the query.
{
"_id": ObjectID("5d9bf09c242af456ff5dd149"),
"configId": "c2",
"name": "ajit test",
"description": "this is test desc",
"confidence": 0,
"report": {
"2019-10-05T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "2.1",
"high": "4.0"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "4.5",
"high": "4.7"
}
}
],
"2019-10-06T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "2.1",
"high": "4.0"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "4.5",
"high": "4.7"
}
}
],
"2019-10-08T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "3.5",
"high": "6.7"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "3.5",
"high": "6.7"
}
}
]
},
}
I looking for a query that must return a sub-set of embedded documents between dates 2019-10-06T02:12:44Z and 2019-10-08T02:12:44Z only.