DBObject在java中映射

use*_*739 2 java mongodb

我需要将MongoDB的结果放在Map中.我的代码是

DBCollection collection = db.getCollection("template");
DBCursor cursor = collection.find(allQuery, removeIdProjection); 
DBObject resultElement = null;
resultElement = cursor.next();
Run Code Online (Sandbox Code Playgroud)

结果Json是:

{"GraphLabel":"工作量订单","XaxisLabel":"2012","YaxisLabel":"volume(k)","ShowLegend":"FALSE","query":"select sd.season_id,sd .season,count(fsf.defect_type_id)来自m2m.season_dim sd,m2m.field_service_fact fsf其中fsf.season_id = sd.season_id group by sd.season_id"}

需要将值与MAP或POJO放在一起..有人可以帮忙吗?

Ori*_*Dar 7

DBObject具有toMap()其中将其转换为地图方法