0
文書を更新しようとしていますが、できません。 私はupdateOne()メソッドだけでなく、update()も使ってみました。MongoCollectionの更新<Documnet>
public boolean updateDocument(String docId, String JSONString) {
try{
MongoCollection<Document> collection = getCollection("abc");
DBObject queryObject = (DBObject)(collection.find(eq("_id","docId")).first());
if(queryObject==null)
return false;
else {
DBObject updateObject = (DBObject)JSON.parse(JSONString);
collection.update(queryObject, updateObject);
return true;
}
}catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
エラーは次のように来ている:メソッドの更新(DBOBJECT、DBOBJECTは)私はupdateOneを使用することができますタイプするMongoCollection のために定義されていないがBSONの引数に適用されますが、私はのdbobjectのために使用する必要があります。.. 缶誰任意の解決策を提案できますか?