Mongodb – Is there a way to project max value in a range then finding documents within a new range starting at this max value in just one aggregate?
Given the following data in a Mongo collection: { _id: "1", dateA: ISODate("2021-12-31T00:00.000Z"), dateB: ISODate("2022-01-11T00:00.000Z") }, { _id: "2", dateA: ISODate("2022-01-02T00:00.000Z"), dateB: ISODate("2022-01-08T00:00.000Z") }, { _id: "3", dateA: ISODate("2022-01-03T00:00.000Z"), dateB: ISODate("2022-01-05T00:00.000Z") }, { _id: "4", dateA: ISODate("2022-01-09T00:00.000Z"), dateB: null },…