Why Spring ReactiveMongoRepository does't have save method for Mono?

后端 未结 1 1861
攒了一身酷
攒了一身酷 2021-01-15 11:49

I have a MovieRepository which extended ReactiveMongoRepository. I want to save a single POJO in a reactive way. But ReactiveMongoRepository doesn\'t provide save method for

相关标签:
1条回答
  • 2021-01-15 12:29

    You could do something like this

     Mono<Movie> movieMonoSaved = movieMono.flatMap(movieRepository::save);
     return ServerResponse.status(HttpStatus.CREATED).body(movieMonoSaved, Movie.class);
    
    0 讨论(0)
提交回复
热议问题