title: AggregationResults Type Cast MongoDB + Spring data + Aggregation
body: <p>I'm asking mongodb from my Spring data application using aggregation and when I get the result I need to cast it (or transform it) to my own object or type and I don't know how.</p>
  
  <p>This is my code</p>
  
  <pre><code>AggregationResults aggregationResults = DBManager.getInstance().getMongoOperation().aggregate(aggregation, LevelEntity.class,Object.class);
  </code></pre>
  
  <p>I would like to have something like</p>
  
  <pre><code>AggregationResults&lt;LevelList&gt; aggregationResults = DBManager.getInstance().getMongoOperation().aggregate(aggregation, LevelEntity.class,LevelList.class);
  </code></pre>
  
  <p>and it gives me back this information</p>
  
  <pre><code>{
          "_id" : {
                  "date" : "24/03/2015"
          },
          "levels" : [
                  {
                          "_id" : ObjectId("54f8627071fdac0ec132b4e5"),
                          "_class" : "org.xxxxxxxxxxx.persistence.model.impl.LevelEntity",
                          "user" : {
                                  "_id" : ObjectId("54da19ce71fd56a173a3451a"),
                                  ...
                                  ...
                                  ...
                          },
                          "level" : 4,
                          "date" : ISODate("2015-03-24T14:04:32.830Z"),
                          "dateFormatted" : "24/03/2015"
                  },
                  {
                          "_id" : ObjectId("54f8627071fdac0ec132b4f4"),
                          "_class" : "org.xxxxxxxxxxx.persistence.model.impl.LevelEntity",
                          "user" : {
                                  "_id" : ObjectId("54e34bd671fde9071569650c"),
                                  ...
                                  ...
                                  ...
                          },
                          "level" : 3,
                          "date" : ISODate("2015-03-24T14:04:32.866Z"),
                          "dateFormatted" : "24/03/2015"
                  }
          ]
  }
  </code></pre>
  
  <p>Can you please help me!!??? </p>
  
  <p>Thanks a lot</p>