zoukankan      html  css  js  c++  java
  • Mongodb中在已有Colloection插入/更新相关域值

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

  • 相关阅读:
    Cpp -- static变量不属于类的实例
    单例模式
    WebView android
    网络编程之一
    初涉json
    初涉XML
    关于JSON的GSON
    网络编程(一)
    硬件51
    重拾C之数据
  • 原文地址:https://www.cnblogs.com/Gingber/p/4680963.html
Copyright © 2011-2022 走看看