大概的意思javamongodb批量更新_java中mongoTemplate批量更新⽅法:Db().getCollection(tableName).bulkWrite(requests);
public BulkWriteResult bulkWrite(List> requests,String tableName) {
BulkWriteResult write =Db().getCollection(tableName).bulkWrite(requests);
哈尔滨培训中心return write;
}
沪科版初中数学目录BulkWriteResult write = Db().getCollection(tableName).bulkWrite(requests);
难点在与如何拼接参数List> requests
例⼦:
DBObject queryObject = new BasicDBObject();
queryObject.put("doctorId",doctorId);
DBObject fields = new BasicDBObject();stamp是什么意思
fields.put("_id",1);
希望天使String tableName = PrefixNo().toLowerCa()+"-record";
List map = mongoService.String(),String(),Map.class,
tableName);
非主流男生昵称boundlessList> requests = new ArrayList>(); //创建参数集合
truthfulness
英语学习社区for(int i=0;i
Document queryDocument = new Document("_id",(i).get("_id")); //条件
本科留学出国Document updateDocument = new Document("$t",new ColName(),dataResult[i])); //更改信息
UpdateOneModel uom = new UpdateOneModel(queryDocument,updateDocument,new UpdateOptions().uprt(fal));
requests.add(uom);
}
BulkWriteResult bulkWriteResult = mongoService.bulkWrite(requests,tableName);