title: MongoTemplate aggregation returns no results after operation
body: <p>I am trying to get some raw data from the mongo collection. I have two similar collections with the same data. When I try to get aggregation results with DBObject list, from first collection data is returned fully but from the second one return nothing. But I need to return data from the second collection. </p>
  
  <p>From my observations, the first collection has documents with field "_class" and another hasn't. In the pipeline's end after projection data similar. I stubbed. </p>
  
  <p>//Document from the first collection</p>
  
  <pre><code>{
      "_id" : ObjectId("5cdd7a0848d4ce0001239b62"),
      "_class" : "com.my.proj.entity.MovementEvent",
      "zoneId" : ObjectId("54e70a7b2cdcc65ef6d80eff"),
      "direction" : "OUT",
      "transportId" : "AAAA",
      "eventDate" : ISODate("2019-05-16T14:56:07Z"),
      "lastUpdated" : ISODate("2019-05-16T14:56:08.571Z")
  }
  </code></pre>
  
  <p>//Document from the second collection</p>
  
  <pre><code>{
      "_id" : ObjectId("5955daa8d87a127b75154c7d"),
      "zoneId" : ObjectId("54e70a7b2cdcc65ef6d80eff"),
      "transportId" : "AAAA",
      "currentDirection" : "OUT",
      "eventDate" : ISODate("2019-05-16T14:56:07Z"),
      "serviceFlag" : false,
      "lastUpdated" : ISODate("2019-05-16T14:56:08.570Z")
  }
  </code></pre>
  
  <p>//Projection object:</p>
  
  <pre><code>ProjectionOperation projectionStage = Aggregation.project()
                  .and(PROJECTION_ELEMENT + "._" + MovementEvent.ID_FIELD).as("_" + MovementEvent.ID_FIELD)
                  .and(PROJECTION_ELEMENT + "." + MovementEvent.DIRECTION).as(MovementEvent.DIRECTION)
                  .and(PROJECTION_ELEMENT + "." + MovementEvent.EVENT_DATE).as(MovementEvent.EVENT_DATE)
                  .and(PROJECTION_ELEMENT + "." + MovementEvent.LAST_UPDATED_FIELD).as(MovementEvent.LAST_UPDATED_FIELD)
                  .and(PROJECTION_ELEMENT + "." + MovementEvent.TRANSPORT_ID).as(MovementEvent.TRANSPORT_ID)
                  .and(PROJECTION_ELEMENT + "." + MovementEvent.ZONE_ID).as(MovementEvent.ZONE_ID);
  </code></pre>
  
  <p>// mongo document after aggregation same for both collection</p>
  
  <pre><code>{
      "_id" : ObjectId("5955daa8d87a127b75154c7d"),
      "zoneId" : ObjectId("54e70a7b2cdcc65ef6d80eff"),
      "transportId" : "AAAA",
      "currentDirection" : "OUT",
      "eventDate" : ISODate("2019-05-16T14:56:07Z"),
      "lastUpdated" : ISODate("2019-05-16T14:56:08.570Z")
  }
  </code></pre>
  
  <p>// aggregation pipeline</p>
  
  <pre><code>AggregationResults&lt;DBObject&gt; result1 = mongoTemplate.aggregate(
                  Aggregation.newAggregation(matchStage, sortStage, groupStage,projectionStage), "lastMovementFlag",DBObject.class);
  </code></pre>
  
  <p>// request to mongo has form like one below </p>
  
  <pre><code>db.lastMovementFlag.aggregate([ 
  {$match:{$and:[{transportId:"AAAA"},{$or:[{"zoneId":ObjectId("54e70a7b2cdcc65ef6d80eff")},{zoneId:ObjectId("54e70b232cdcc65ef6d80f00")}]}]}}, 
  {$sort:{eventDate:1}}, 
  {$group:{_id:{transportId:"$transportId"}, last:{$last:"$$ROOT"}}},
  {$project:{_id:"$last._id", _class:"$last._class",direction:"$last.currentDirection",eventDate:"$last.eventDate",lastUpdated:"$last.lastUpdated",transportId:"$last.transportId", zoneId:"$last.zoneId"}} 
  ])
  </code></pre>
  
  <p>I can retrieve data from "Movements" collection but from "lastMovementFlag" can't. AggregationResults is empty.</p>