//查询语句
BasicDBObject idDB = new BasicDBObject().append("$match", new BasicDBObject().append("d", battID));
BasicDBObject sortDB=new BasicDBObject().append("$sort", new BasicDBObject().append("t", -1));
BasicDBObject limitDB=new BasicDBObject().append("$limit", 10);
BasicDBObject groupDB = new BasicDBObject();
groupDB.append("_id", "$d");
groupDB.append("sum", new BasicDBObject().append("$sum", "$r"));
groupDB.append("max", new BasicDBObject().append("$max", "%r"));
groupDB.append("min", new BasicDBObject().append("$min", "%r"));
。。。。
DBObject resultData =MongoDBx.ecohis().main.getCollection("reshis").aggregate(??);
mongodb版本?
2.0的
@缘猿~: 太老了吧,你要么用3.04以上版本,要么用mapreduce做
@Daniel Cai: 哦哦,是这样啊!不过已经用其他方式获取啦!!呵呵,谢谢喽
@缘猿~: how?
@Daniel Cai: 我现在是把数据取出后计算这些值!