@MongoId is actually pretty useful in cases when a class is stored in mongo as well as used as a response in REST API. At the moment kmongo forces id field to be named _id which makes it impossible to use with existing model classes that already use kotlinx.serialization and can't have id field be renamed to _id.
@MongoId
is actually pretty useful in cases when a class is stored in mongo as well as used as a response in REST API. At the moment kmongo forces id field to be named_id
which makes it impossible to use with existing model classes that already usekotlinx.serialization
and can't haveid
field be renamed to_id
.