Java 往 MongoDB 插入文档的几种方法
2 回答
牛魔王的故事
TA贡献1830条经验 获得超3个赞
1 2 3 4 5 6 7 8 9 10 11 12 | BasicDBObject document = new BasicDBObject(); document.put("database", "mkyongDB"); document.put("table", "hosting");
BasicDBObject documentDetail = new BasicDBObject(); documentDetail.put("records", "99"); documentDetail.put("index", "vps_index1"); documentDetail.put("active", "true");
document.put("detail", documentDetail);
collection.insert(document); |
添加回答
举报
0/150
提交
取消