title: Spring mongodb query nested array containing nested arrays
body: <p>i have these 3 class</p>
  
  <pre><code>@Document(collection = "Countries")
  class CountryDoc
  {
      @Id
      lateinit var id : String
  
      var name : String = ""
  
      var governorates : ArrayList&lt;Governorate&gt; = ArrayList()
  
  }
  
  class Governorate
  {
      var id : String = ""
  
      var name : String = ""
  
      var cardinalPoint : CardinalPoint = CardinalPoint.SOUTH_WEST
  
      var cities : ArrayList&lt;City&gt; = ArrayList()
  }
  
  class City
  {
      var id : String = ""
  
      var name : String = ""
  }
  </code></pre>
  
  <p>and i want to get the full address of a city, the result must be like this</p>
  
  <pre><code>{
    "countryId" : ""
    "countryName" : "",
    "governorateId" : "",
    "governorateName" : "",
    "cardinalPoint" : ""
    "cityId" : "",
    "cityName" : ""
  }
  </code></pre>
  
  <p>i tried this query but it did not work, I had only the information of the country</p>
  
  <pre><code>    val countryCriteria = Criteria.where("id").`is`(countryId)
      val governorateCriteria = Criteria.where("id").`is`(governorateId)
      val cityCriteria = Criteria.where("id").`is`(cityId)
  
      val aggregation = Aggregation.newAggregation(
          Aggregation.match(countryCriteria),
          Aggregation.project().and("id").`as`("countryId").and("name").`as`("countryName"),
          Aggregation.unwind("governorates"),
          Aggregation.match(governorateCriteria),
   Aggregation.project().and("name").`as`("governorateName").and("id").`as`("governorateId").and("cardinalPoint").`as`("cardinalPoint")
          Aggregation.unwind("cities"),
          Aggregation.match(cityCriteria)
          Aggregation.project().and("name").`as`("cityName").and("id").`as`("cityId")
      )
  
  val result = mongoDb.aggregate(aggregation, CountryDoc::class.java, Address::class.java).uniqueMappedResult
  </code></pre>
  
  <p>i can't understand why that does not works for me, can someone help me?</p>