Say I have to following document:
{
"_id" : ObjectId("5dd7ae6ac48884404d3123be"),
"startDate" : ISODate("2019-01-27T23:00:00.000Z"),
"facility" : 1000100001,
"endDate" : ISODate("2021-01-27T23:00:00.000Z"),
"preCalcDates" : [
{
"start" : ISODate("2019-01-31T06:00:00.000Z"),
"end" : ISODate("2019-01-31T13:00:00.000Z")
},
{
"start" : ISODate("2019-02-01T06:00:00.000Z"),
"end" : ISODate("2019-02-01T13:00:00.000Z")
},
{
"start" : ISODate("2019-02-07T06:00:00.000Z"),
"end" : ISODate("2019-02-07T13:00:00.000Z")
},
{
"start" : ISODate("2019-02-08T06:00:00.000Z"),
"end" : ISODate("2019-02-08T13:00:00.000Z")
},
{
"start" : ISODate("2019-02-14T06:00:00.000Z"),
"end" : ISODate("2019-02-14T13:00:00.000Z")
},
{
"start" : ISODate("2019-02-15T06:00:00.000Z"),
"end" : ISODate("2019-02-15T13:00:00.000Z")
}
],
"__v" : 0
}
I want to find all documents with facility 1000100001 (also got others), return the whole document, except the entire field preCalcDates. From preCalcDates I want to return only the documents, that have "start" beween 2019-02-07 and 2019-02-14. How would I do that?