Aggregation agg = Aggregation.newAggregation( match(Criteria.where("time").gte(start).lt(end).and("fid").in(fid)), project("fid","time","rawValue").and("time").plus(28800000).as("times"), project("times","fid","time","rawValue").and("times").project("substr", 0,substrend).as("str"), group(fields().and("str").and("fid")) .min("time").as("minTime") .min("rawValue").as("minValue") .max("time").as("maxTime") .max("rawValue").as("maxValue"), sort(Sort.DEFAULT_DIRECTION,"_id.fid","minTime"), skip(begin), limit(rows) );
为什么截取的是time字段,而不是times,下面是控制台打印project部分
{ "$project" : { "fid" : 1 , "time" : 1 , "rawValue" : 1 , "times" : { "$add" : [ "$time" , 28800000]}}} ,
{ "$project" : { "times" : 1 , "fid" : 1 , "time" : 1 , "rawValue" : 1 , "str" : { "$substr" : [ "$time" , 0 , 10]}}}
怎么截取times