Aggregation aggregation=Aggregation.newAggregation(
Aggregation.match(criteria),
Aggregation.project("ctime","ptime").andExpression("ptime - ctime").as("c").and(DateOperators.DateToString.dateOf("create_at").toString("%Y-%m")).as("month"),
Aggregation.group("month").avg("c").as("c0"));
List<Object> list=mongoDBImpl.countCommon(aggregation, "device_alarm");
List<Map<String, Object>> line=new ArrayList<>();
虽然参数顺序没有指定,但是有时候把project放在第一个查不出数据,