Potential problem with having to use to many unwinds - maybe bad schema design?

I have two fields in my docs, one is called ‘files’ and is an array of objects.
The second field is called “subdirectories”, also an array that contains an array (of objects) within it called “subdirectories.files”

Within the objects of said array are fields that are arrays as well. I call those fields - metadata. For one aggregation I need these metadata arrays unwound.

So as an example for the first array 'files" I first have to unwind the array, from there also unwind the metadata arrays.


[
  {
    '$match': {
      'files.metadata': {
        '$exists': true
      }
    }
  }, {
    '$unwind': {
      'path': '$files'
    }
  }, {
    '$unwind': {
      'path': '$files.metadata'
    }
  }, ...........
]

Basically I’m looking for feedback for a) does the schema fields sound ok and b) is my strategy for aggregating the metadata on the right track ? I have considered moving the metadata to another collection but maybe that is the way to go.

TIA!