-1
public Flux<PortCall> updateByFindById(String gsisKey, PortCall portCall) {
    return portCallRepository.findAllByVesselCode(portCall.getVesselCode())
            .collectList().flatMap(list->{
                return portCallRepository.saveAll(Flux.fromIterable(list));
            });
                    
}

Here I'm trying to invoke saveAll() of SimpleReactiveMongoRepository i.e public Flux saveAll(Iterable entities)

Puneet
  • 13
  • 1
  • 6
  • `Flux.fromIterable(list)` returns a `Flux` while `saveAll` takes a `Iterable`. A `Flux` is not a `Iterable`. Try just calling `portCallRepository.saveAll(list)`. Or just skip the `collectList` and use `save` it will still just make a single transaction to the database. – Toerktumlare Jan 31 '21 at 20:10

1 Answers1

0

Don't you want:

public Flux<PortCall> updateByFindById(String gsisKey, PortCall portCall) {
    return portCallRepository.saveAll(
         portCallRepository.findAllByVesselCode(portCall.getVesselCode())
    );
}
K.Nicholas
  • 10,956
  • 4
  • 46
  • 66
  • Nope, I'm trying to update the list and then save into DB, the update logic has been removed to keep the question concise. – Puneet Jan 31 '21 at 16:07