查找特定记录并进行更新

问题描述 投票:0回答:1

查找特定记录并进行更新

studentRepository.findByStudid(studId).log().map(existingStud -> {
                                            return studentRepository.save(existingStud); // This return Mono defer ??
                                        }).subscribe(System.out::println);
mongodb spring-boot reactive-programming project-reactor
1个回答
0
投票

您应该使用.flatMap而不是.map运算符。它将订阅从save返回的内部单声道。

map vs flatMap in reactor

© www.soinside.com 2019 - 2024. All rights reserved.