Hi guys i am using mongo and ktor but when i am re...
# server
b
Hi guys i am using mongo and ktor but when i am retrieving data i am getting this exception
org.bson.codecs.configuration.CodecConfigurationException: Unable to invoke primary constructor of Note data class
my data class is
Copy code
@Serializable
data class Note(
    @SerialName("_id")
    @Contextual
    val id: ObjectId = ObjectId(),
    val title: String,
    val userId:String,
    val description: String,
    val dateCreated: Long,
    val dateUpdated: Long,
)
any help is really appriciated
the thing happening us i am getting no response here its just taking time and giving me exception and also i need the id as a string how should i do that
u
Check the spelling, and also make it nullable and add empty string or 0 value every variable and when you query make it list
m
Which mongo library are you using?
b
@Mervyn McCreight Mongo Coroutine Driver
official one by mongoDb
@Ume Channel that didn't help i did give default values for everything still it didnt help
The thing that helped me is i did make the id a string and while inserting i assigned the object id as hex String
🐕 1
u
@Bharat Kumar Thats great
kodee happy 1