No converter found capable of converting from type [org.bson.types.ObjectId] to type [java.lang.Inte

No converter found capable of converting from type [org.bson.types.ObjectId] to type [java.lang.Integer]

在使用MongoDB进行查询时报错

报错语句为 类型不兼容,表里的字段类型与实体类字段类型不符

查看MongoDB 与实体类对比

 

 结果发现二者没有任何区别这就让人纳闷,我怀疑是以为mongoDB自带的 _id 会让JAVA 误以为是 id  ,修改字段名与实体类名;

 

重新启动测试一下

完美解决,原因:两个ID冲突了

猜你喜欢

转载自blog.csdn.net/m0_73093747/article/details/127694435