Database

db={"competitions":[{"_id":10000,"teams":[{"_id":100,"name":"team 1"},{"_id":101,"name":"team 2"}]},{"_id":10001,"teams":[{"_id":100,"name":"team 3"},{"_id":102,"name":"team 5"}]}],"scores":[{"competitionId":10000,"teamId":100,"score":100,"type":"league"},{"competitionId":10001,"teamId":100,"score":100,"type":"league"}]}

Query

db.scores.aggregate([{$match:{"type":"league"}},{$lookup:{"from":"competitions","localField":"competitionId","foreignField":"_id","as":"comp"}},{$unwind:{"path":"$comp","preserveNullAndEmptyArrays":true}},{$unwind:{"path":"$comp.teams","preserveNullAndEmptyArrays":true}},{$group:{"_id":"$comp.teams._id","results":{$push:"$comp.teams"}}}])

Result