我用的robomongo,要统计不重复的数据
比如
我要统计2017-03-24当天的数据有3条,根据age去重查询的数据有2条
我要怎样写查询,,,,,,新手求教!!
mongodb去重复统计查询
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答
qq_20408589 2017-03-24 06:36关注Datastore datastore = simpleMongoDBDao.getDB();
Query<类> query = datastore.createQuery(类.class);
query=query.filter("条件字段 = ", “”);
AggregationPipeline pipeline = datastore.createAggregation(类.class)
.match(query)
.group(
id(
grouping("age")
),
grouping("name","name"),
grouping("age",first("age"))
).sort(Sort.descending("time"));
Iterator<类> iterator = pipeline.aggregate(类.class);解决 无用评论 打赏 举报