Database

[{"id":1,"teamsIds":["team_a","team_b"]},{"id":2,"teamsIds":["team_a","team_c"]},{"id":3,"teamsIds":["team_c","team_a"]},{"id":4,"teamsIds":["team_c"]},{"id":5,"teamsIds":["team_b"]},{"id":6,"teamsIds":[]},{"id":7}]

Query

db.collection.aggregate([{"$match":{/** your match here*/}},{"$project":{"id":1,"matchingFilter":{"$ne":[[],{"$setIntersection":[{"$ifNull":["$teamsIds",[]]},/** your input array here*/["team_c","team_a"]]}]}}}])

Result