mongo aggregate查询
Aggregation aggregation =Aggregation.newAggregation(
Aggregation.match(Criteria.where("source").is(source).and("name").in(temp)),
Aggregation.group("name").max("endTime").as("lastTime"),
Aggregation.match(Criteria.where("lastTime").lt(datePoint.getTime())),
Aggregation.project("_id")
).withOptions(Aggregation.newAggregationOptions().allowDiskUse(true).build());
AggregationResults<HashMap> update_strategy = mongoTemplate.aggregate(aggregation, "update_strategy", HashMap.class);

浙公网安备 33010602011771号