I've recently been using Kmongo library and Kotlin together however I've made an issue on Kmongo but I'm unsure it is related to the library.
I'm trying to persist my data onto my mongo database (version 4.2.2)
@Serializable
data class Person(val firstname: String, val lastname: String){
val fullName
get() = "$lastname $firstname"
}
When I insert the data I sent only an object like this : val person = Person("John", "Doe")
but when I do check on my mongo database
db.persons.find()
> { "_id" : ObjectId("5e2da298159243f9894d3834"), "firstname" : "John", "lastname" : "Doe", "fullName" : "Doe John" }
How can I prevent to get fullName
saved in my database ?
EDIT:
I tried to use @Transient
annotation on my variable but it didn't work, and I got an inspection message saying : Property does not have backing field which makes it non-serializable and therefore @Transient is redundant