【发布时间】:2016-12-22 13:45:10
【问题描述】:
我正在使用以下示例 json:
JSONObject json=new JSONObject();
json.put("time_range", "22-23");
json.put("flow_id", "786");
并尝试转换为 Document 如下:
Document doc = (Document) JSON.parse(jsonlist.toString()); // conversion from json to Document
col.insertOne(doc); // inserting into Mongo collection
我面临以下错误:
java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to org.bson.Document
谁能帮我解决这个问题...
【问题讨论】: