Database

[{"year":2020,"wine":"wine1"},{"year":2020,"wine":"wine2"},{"year":2019,"wine":"wine2"},{"year":2018,"wine":"wine3"},{"year":2017,"wine":"wine4"},{"year":2016,"wine":"wine1"},{"year":2014,"wine":"wine4"},{"year":2015,"wine":"wine1"}]

Query

db.collection.aggregate([{$group:{_id:null,"newestWineYear":{$max:"$year"},data:{$push:"$$ROOT"}}},{$unwind:"$data"},{$match:{"$expr":{"$gte":["$data.year",{"$subtract":["$newestWineYear",5]}]}}},{$group:{_id:null,count:{"$sum":1}}}])

Result