| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
PLAW3kEDF
9年前发布

java mongo 查询统计 distinct


Date lastExcTime=new Date();


CommandResult result = mongoTemplate.getDb().command(

new BasicDBObject("distinct", "homeLog").append("key",

"userId").append(

"query",

new BasicDBObject("createTime", new BasicDBObject(

"$gte", lastExcTime))));

JSONArray bean=JSONArray.parseArray(result.getString("values"));

                        System.out.println(bean.size());