I'm new to Kotlin development and I cannot figure out how to deal with this issue. I have the following Kotlin data class mapped to a MongoDB collection (Spring Data MongoDB):
@Document(collection = "orders")
data class OrderEntity
@PersistenceConstructor
constructor(@Id val id: ObjectId? = null, val place: String, var date: Date,
val closed: Boolean = false, val price: Int = 0)
I want to override the default id getter and return a string instead of an ObjectId. It seems that "id" field name cannot be changed because I'm getting the message "Customizing field name for id property not allowed! Custom name will not be considered!" so I can't use the _id solution that is always suggested.
How could one achieve this? Am I missing something?