I have a document like this:
{
"_id": ObjectId(),
"dayoffs" : [
{
"kind" : "A",
"from" : ISODate("2022-01-01T03:00:00Z"),
"to" : ISODate("2022-01-01T03:00:00Z"),
"reason" : "B",
"_id" : ObjectId("62d66bc24c17ee18272f97ad"),
"approvers" : [ ]
},
{
"kind" : "A",
"from" : ISODate("2022-01-01T03:00:00Z"),
"to" : ISODate("2022-01-01T03:00:00Z"),
"reason" : "B",
"_id" : ObjectId("62d66be73844cc213cf958cf"),
"approvers" : [ ]
},
{
"kind" : "A",
"from" : ISODate("2022-01-02T01:30:00Z"),
"to" : ISODate("2022-01-02T10:30:00Z"),
"reason" : "B",
"_id" : ObjectId("62e238306821bfc1ee2bd308")
},
{
"kind" : "A",
"from" : ISODate("2022-01-03T01:30:00Z"),
"to" : ISODate("2022-01-03T10:30:00Z"),
"reason" : "B",
"_id" : ObjectId("62e2386dda2753fad5ca65ce")
}
]
}
I try to query like this:
{
"$match": {
"dayoffs.from": {
"$gte": new Date("2022/01/03")
},
"dayoffs.to": {
"$lte": new Date("2022/01/03 23:59:00")
}
}
}
Why can’t I get dayoffs with from and to within a day 2022/01/03?