MongoDB Aggregate – Query to get items that match key in first item of sort
We have the following records in a collection: { "_id" : ObjectId("1"), "date" : ISODate("2017-02-01T00:00:00Z") } { "_id" : ObjectId("2"), "date" : ISODate("2017-02-01T00:00:00Z") } { "_id" : ObjectId("3"), "date" : ISODate("2017-03-03T00:00:00Z") } { "_id" : ObjectId("4"), "date" : ISODate("2017-02-02T00:00:00Z") }…