So, I have this data in my DB,
[
{
"_id": ObjectId("5a934e000102030405000000"),
"from": "1970-01-01",
"to": "1970-01-05"
},
{
"_id": ObjectId("5a934e000102030405000001"),
"from": "2017-04-18",
"to": "2017-04-23"
},
{
"_id": ObjectId("5a934e000102030405000002"),
"from": "2018-01-29",
"to": "2018-01-30"
},
{
"_id": ObjectId("5a934e000102030405000003"),
"from": "2018-01-02",
"to": "2018-01-08"
}
]
Is it possible that I pass year as 2018 and month as 01 then I get matching data from the all data? Like here I got last two Documents from collection.
I tried $elemMatch: query but didn't get expected result.