当前位置:Gxlcms > 数据库问题 > Mongodb中在已有Colloection插入/更新相关域值

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

时间:2021-07-01 10:21:17 帮助过:10人阅读

[{
"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插入/更新相关域值

标签:

人气教程排行