码迷,mamicode.com
首页 > 数据库 > 详细

Mongodb中在已有Colloection插入/更新相关域值

时间:2015-07-27 20:32:26      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

[{
"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);

Mongodb中在已有Colloection插入/更新相关域值

标签:

原文地址:http://www.cnblogs.com/Gingber/p/4680963.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!