Spring Boot &MongoDB 如何删除“_class"列? [英] Spring Boot & MongoDB how to remove the '_class' column?
问题描述
在MongoDB Spring Data中插入数据时添加自定义_class"列,使用Spring Boot时有没有办法消除class"列&MongoDB?
When inserting data into MongoDB Spring Data is adding a custom "_class" column, is there a way to eliminate the "class" column when using Spring Boot & MongoDB?
或者我需要创建自定义类型映射器吗?
Or do i need to create a custom type mapper?
有什么提示或建议吗?
推荐答案
我认为您需要创建一个 @Bean
类型的 MongoTemplate
并明确设置类型转换器.详细信息(非引导,只是提取模板配置):http://www.mkyong.com/mongodb/spring-data-mongodb-remove-_class-column/
I think you need to create a @Bean
of type MongoTemplate
and set the type converter explicitly. Details (non-Boot but just extract the template config): http://www.mkyong.com/mongodb/spring-data-mongodb-remove-_class-column/
这篇关于Spring Boot &MongoDB 如何删除“_class"列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!