Mongodb中在已有Colloection插入/更新相关域值
2015-07-27 18:56
761 查看
[{
"confident" : "no",
"score" : 0.327355,
"label" : "/business and industrial"
}, {
"confident" : "no",
"score" : 0.207099,
"label" : "/automotive and vehicles/certified pre-owned"
}, {
"confident" : "no",
"score" : 0.128601,
"label" : "/technology and computing/internet technology/social network"
}]
Java Code:
BasicDBList dblist = new BasicDBList();
// 追加的方式
dblist.add(new BasicDBObject("label", topic.getField("categoryName")).append("score", topic.getField("score")));
updatedValue.put("calais", dblist);
DBObject updateSetValue = new BasicDBObject("$set", updatedValue);
insertdbCollection.update(updateCondition, updateSetValue);
"confident" : "no",
"score" : 0.327355,
"label" : "/business and industrial"
}, {
"confident" : "no",
"score" : 0.207099,
"label" : "/automotive and vehicles/certified pre-owned"
}, {
"confident" : "no",
"score" : 0.128601,
"label" : "/technology and computing/internet technology/social network"
}]
Java Code:
BasicDBList dblist = new BasicDBList();
// 追加的方式
dblist.add(new BasicDBObject("label", topic.getField("categoryName")).append("score", topic.getField("score")));
updatedValue.put("calais", dblist);
DBObject updateSetValue = new BasicDBObject("$set", updatedValue);
insertdbCollection.update(updateCondition, updateSetValue);
相关文章推荐
- NoSql——mongoDB(基础)
- 使用nodejs+mongodb+百度开放云开发微信或web应用
- Ubuntu mongodb 安装 开发测试
- Mongodb并发与锁机制
- MongoDB for node.js developers 七周学习-最终测试小结(2)
- mongodb启动失败汇总
- MongoDB:too much data for sort() with no index error异常
- MongoDB 宕机案例
- MongoDB学习笔记(六) MongoDB索引用法和效率分析
- MongoDB学习笔记(三) 在MVC模式下通过Jqgrid表格操作MongoDB数据
- MongoDB学习笔记(五) MongoDB文件存取操作
- MongoDB学习笔记(四) 用MongoDB的文档结构描述数据关系
- MongoDB学习笔记(二) 通过samus驱动实现基本数据操作
- MongoDB学习笔记(一) MongoDB介绍及安装
- 【MongoDB】在windows平台mongodb切片集群(三)
- MongoDB
- Win7下MongoDB的安装和部署测试
- windows安装 MongoDB 3.0.4
- golang中使用mongodb
- 第一节 MongoDB介绍及下载与安装