MongoDb aggregation query conversion to Spring-data
<p>I have a aggregate function wherein the structure of the output of the method is :</p>

<pre><code> {
    "_id" : {
        "vehicleNumber" : "HR55W8395",
        "vehicleType" : "TYPE_32"
    },
    "mileage" : [
        3.4200838876537736,
        3.6082731400212595,
        3.7118590539249254,
        2.9805899622661784,
        5.227747018794297,
        3.222515049264743,
        3.8845896154778603,
        3.548054585322907,
        3.010341324091653
    ]
}
</code></pre>

<p>The aggregate function is </p>

<pre><code>db.hop.aggregate([{$group : {_id : {vehicleNumber : "$vehicleNumber", vehicleType : "$vehicleType"}, mileage: {$push : "$mileage"}}}])
</code></pre>

<p>and the aggregate in spring written is  : </p>

<pre><code>AggregationOperation match = match(Criteria.where("startHubOutTime").gte(startDateTime).and("endHubInTime").lte(endDateTime).and("vehicleNumber").exists(true).and("mileage").exists(true));
        //GroupOperationBuilder group = Aggregation.group("vehicleNumber","vehicleType").push("mileage");
        AggregationOperation grAggregationOperation =Aggregation.group("vehicleNumber","vehicleType").push(new BasicDBObject("mileage","$mileage")).as("mileage"); ;//group.as("_id");
        AggregationOperation project = Aggregation.project("mileage").andInclude("vehicleNumber","vehicleType");
        Aggregation newAggregation = Aggregation.newAggregation(match, grAggregationOperation);
        AggregationResults&lt;AggregatedMileageOutput&gt; aggregatedMileageOutputs = mongoTemplate.aggregate(newAggregation, Hop.class, AggregatedMileageOutput.class);
</code></pre>

<p>and  the output is : 
AggregatedMileageOutput </p>

<pre><code>class AggregatedMileageOutput {
    private String vehicleNumber;
    private VehicleType vehicleType;
    private ArrayList&lt;Double&gt; mileage;
}
</code></pre>

<p>but during aggregation operation I am getting an error : </p>

<pre><code>Request processing failed; nested exception is org.springframework.data.mapping.model.MappingException: No mapping metadata found for java.lang.Double

Stack trace : 
org.springframework.data.mapping.model.MappingException: No mapping metadata found for java.lang.Double
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:228)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:906)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1183)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$200(MappingMongoConverter.java:78)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1133)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:869)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:282)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:270)
    org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:270)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:231)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:191)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187)
    org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:78)
    org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:2215)
    org.springframework.data.mongodb.core.MongoTemplate$UnwrapAndReadDbObjectCallback.doWith(MongoTemplate.java:2248)
    org.springframework.data.mongodb.core.MongoTemplate.returnPotentiallyMappedResults(MongoTemplate.java:1533)
    org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1509)
    org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1435)
</code></pre>

<p>Please help for this.</p>