mongodb中的$ match和$ group

时间:2018-06-18 04:22:11

标签: java mongodb

我通过post_id尝试分组并与dt匹配但是组不起作用。

 AggregateIterable output = collection.aggregate(Collections.singletonList(Document.parse(
            "{$match : {dt : {$gte: 1528787014130,$lt:1528787054130 }}}," +
                    "{$group : { _id : '$post_id' ,avg : {$avg : '$duration'}, max :{$max" +
                    " : '$duration'},min :{$min : '$duration'}}}}")));

如何让$ group工作

0 个答案:

没有答案