我用mongodb group查询,查询之后只有一个分组字段和count字段,怎么显示更多字段?
BasicDBObjectkey=newBasicDBObject("city",true);BasicDBObjectcond=newBasicDBObject();B...
BasicDBObject key = new BasicDBObject("city",true);
BasicDBObject cond = new BasicDBObject();
BasicDBObject initial = new BasicDBObject("cou",0);
String reduce = "function(obj,pre){pre.cou++}";
BasicDBList returnList = (BasicDBList)dbCollection.group(key, cond, initial, reduce);
这个是代码,结果只显示“city”和“cou”两个字段 展开
BasicDBObject cond = new BasicDBObject();
BasicDBObject initial = new BasicDBObject("cou",0);
String reduce = "function(obj,pre){pre.cou++}";
BasicDBList returnList = (BasicDBList)dbCollection.group(key, cond, initial, reduce);
这个是代码,结果只显示“city”和“cou”两个字段 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询