CollectionSpace space = sdb.getCollectionSpace(spaceName);
DBCollection db = space.getCollection(collectionName);
List list = new ArrayList();
//SQL如下,
// select sum(coins) as sum from platform.t_user where _id = { "$oid": "55c06d19ace7e912643c9211" }
DBCursor cus = db.aggregate(list);
1. 查询条件 主键 _id 如何设置? SQL中并不支持_id查询.只能如下.
BasicBSONObject matcher = new BasicBSONObject();
ObjectId oid = new ObjectId(id);
matcher.put("_id", oid);
2. 我设置了matcher之后 上面的list我怎么添加?
查询字段算sum(coins);
请帮忙解答下. 万分感谢!