Java 去 MongoDB 插入文档的几种方法

Java 往 MongoDB 插入文档的几种方法detail : {records : 99, index : vps_index1, active :

Java 往 MongoDB 插入文档的几种方法
"'detail' : {'records' : 99, 'index' : 'vps_index1', 'active' : 'true'}}}";

DBObject dbObject = (DBObject)JSON.parse(json);

collection.insert(dbObject);

DBCursor cursorDocJSON = collection.find();
while (cursorDocJSON.hasNext()) {
System.out.println(cursorDocJSON.next());
}

collection.remove(new BasicDBObject());

} catch (UnknownHostException e) {
e.printStackTrace();
} catch (MongoException e) {
e.printStackTrace();
}

}
}

?