Database

[{"key":1,dt:ISODate("2010-01-01")},{"key":2,dt:ISODate("2020-01-01")},{"key":3,dt:ISODate("2021-01-01")}]

Query

db.collection.aggregate([/** compute latest records in 2 years*/{$setWindowFields:{sortBy:{dt:1},output:{recentRecords:{$push:"$$ROOT",window:{range:[-2,0],unit:"year"}}}}},/** find latest records in whole collection*/{"$sort":{dt:-1}},{$limit:1},/** cosmetics*/{"$unwind":"$recentRecords"},{"$replaceRoot":{"newRoot":"$recentRecords"}}])

Result