mongoDB批量操作

管理员 105次浏览

摘要:mongoDB批量跟新

正文:

					
					    
//批量跟新
BulkOperations ops = mongoTemplate.bulkOps(BulkOperations.BulkMode.UNORDERED, BusinessPlanItemized.class);
saveDto.getSubItems().forEach(data -> {
Update u = new Update().set("surplus", data.getItemBusinessControlAmount().subtract(data.getControlNum()));
Query q = new Query(Criteria.where("id").is(data.getId()));
ops.updateOne(q, u);
});

ops.execute();




文章参考自:https://blog.csdn.net/sinat_24044957/article/details/80646292?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&dist_request_id=1328679.10723.16161542876051701&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control

表情

共0条评论