//get the collection
DBCollection coll = MongoDBClient.getInstance().getAlarmInfoCollection();
DBObject query = new BasicDBObject();
query.put(aa, "51d2b09f81b8a943f9e825aa");
DBObject update = new BasicDBObject();
DBObject history = new BasicDBObject();
history.put("ishistory", 1);
history.put("acknowledged", 1);
history.put("state", 1);
update.put("$set", history);
coll.updateMulti(query, update);
Run Code Online (Sandbox Code Playgroud)
使用程序之前更新mongodb中的文档,但有时它可以成功,有时它只更新两个字段(字段,"状态",没有更新),并且propram没有报告任何错误.我的课程有什么错吗?