You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Document
data classUser(
@Id
varid:ObjectId? = null,
varusername:String,
)
@Document
data classPost(
@Id
varid:ObjectId? = null,
vartitle:String,
varcontent:String?,
@DocumentReference
varauthor:User? = null
)
val user = mongoTemplate.save(User(null, "username0"))
val post = mongoTemplate.save(Post(null, "title0", "content0", user))
mongoTemplate.findById<Post>(post.id!!)
Exceptions is in here.
No converter found capable of converting from type [org.bson.types.ObjectId] to type [com.demo.User]
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.types.ObjectId] to type [com.demo.User]