We now have a connection to our database and we can send commands, but we need to learn how we can add or modify data in our collection since this Spring provides Reactive repositories.
Reactive repositories
Creating a repository
First, we need to bring back our Customer class that we used in our previous example since we are going to use it now, so let's add it to our project:
package com.microservices.chapter5
data class Customer(var id: Int=0, var name: String="", var telephone: Telephone? = null) {
data class Telephone(var countryCode: String = "", var telephoneNumber: String = "")
}
But we need to modify it in order to store it in our MongoDB. We will set the name of the collection to...