January 2018
Intermediate to advanced
414 pages
10h 29m
English
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.chapter5data 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 store this object using @Document:
package com.microservices.chapter5import org.springframework.data.mongodb.core.mapping.Document@Document(collection = "Customers")data class Customer(var id: Int=0, var name: String="", var telephone: Telephone? = null) {
Read now
Unlock full access