I’m struggling with querying an array of nested arrays. I need a query that that will find all projects where at least one of skillsetCombinations’s has all skillsets in my searched combination, see playground Mongo playground

Example:
find skillsetCombination [A,B,D] => result project1, project3
find skillsetCombination [A,B] => result project3
find skillsetCombination [A,B,D,E] => result project1, project2, project3

Hi, basically, I’m looking for project where project’s nested array is subset of my array (or equal to my array).

Example explanation:
find skillsetCombination [A,B,D] =>
project1: [ABD] is subset of [ABD] - should be returned
project3: [AB] is subset of [ABD]) - should be returned
project2: none of [XYZ],[ABDE],[UVW] are subsets of [ABD] so this project shouldn’t be returned

Any idea how do to it? I have working query with aggregation using NIN operator on inverted items. See, Mongo playground if you are looking for all projects with ABD I do NIN on all other letters.

I was not able to come up with the exact combination but I have a feeling that a $reduce on a $map that uses $setIsSubset could be the key to the solution.