首页 新闻 会员 周边 捐助

mongoTemplate截取字段字符串问题??

0
悬赏园豆:10 [待解决问题]
        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

bichen的主页 bichen | 初学一级 | 园豆:190
提问于:2015-01-22 17:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册