So far, we have delved into the repository solution using both query by property and Query by Example. There is another angle we can use, MongoTemplate.
MongoTemplate mimics the Spring Framework's JdbcTemplate, the first data access mechanism implemented by Spring. JdbcTemplate allows us to focus on writing queries while delegating connection management and error handling to the framework.
MongoTemplate brings the same power to bear on crafting MongoDB operations. It's very powerful, but there is a critical tradeoff. All code written using MongoTemplate is MongoDB-specific. Porting solutions to another data store is very difficult. Hence, it's not recommended as the first solution, but as a tool to keep in our back pocket for critical operations that require highly tuned MongoDB statements.
To perform reactive MongoTemplate operations...