Mongo Playground

Configuration

db={"UserQualifications":[{"_id":ObjectId("5a934e000102030405000001"),"expiry_date":22,"qualification":ObjectId("5a934e000102030405000000"),"user":1},{"_id":ObjectId("5a934e000102030405000002"),"expiry_date":25,"qualification":ObjectId("5a934e000102030405000001"),"user":2}],"Qualifications":[{"_id":ObjectId("5a934e000102030405000000"),"fleet":["FleetA","FleetB","FleetC"]},{"_id":ObjectId("5a934e000102030405000001"),"fleet":["FleetA","FleetC"]}]}

Query

db.UserQualifications.aggregate([{$lookup:{from:"Qualifications",localField:"qualification",foreignField:"_id",as:"qualification",},},{$unwind:"$qualification",},{$match:{"qualification.fleet":{$in:["FleetA","FleetC"],},expiry_date:{$lt:30},"qualification._id":{$in:[ObjectId("5a934e000102030405000000")]}},}])

Result