See this there are answers for this and for the updated one you asked.
I think something went wrong, and the one i was answering was deleted, but i found the same question duplicated by mistake, so i posted there the answer, hope all ok with your acount.
Both answers are complicated and slow, because you wanted in the answer to have data in keys, keys are better for the schema, and values to go to arrays or values in objects , not keys.
I’ve also added sugar field in that but its not showing in output because you have added weight and flavour separately in $filter. Please show me another way of doing this @Takis