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);

posted @ 2019-07-05 14:11  笠清  阅读(419)  评论(0编辑  收藏  举报