1 回答

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超3個(gè)贊
看起來您在 updateOne 方法中使用了數(shù)據(jù)。相反,它應(yīng)該是命令BasicDBObject。就像下面這樣,
MongoCollection<Document> collection = mongodb.getCollection("PropertiesMQ");
BasicDBObject filter = new BasicDBObject();
filter.put("NOMBRE_HOST", host);
filter.put("BASEDATOS.SID", sid);
BasicDBObject data = new BasicDBObject();
data.put("BASEDATOS.$.IsContingenciaBD", state);
BasicDBObject command = new BasicDBObject();
command.put("$set", data);
System.out.println(filter + ", " + command);
collection.updateOne(filter, command); //Use Command instead of data
添加回答
舉報(bào)