我正在创建一个 Spring Boot 应用程序,并且在前端使用 AngularJS。
在提交带有适当参数的表单后,Spring 应该使用bookRepository.save()
方法将提供的数据保存在 MongoDB 中。问题是,这个动作继续进行,但我的模型的结构没有得到尊重。
@Document(collection = "books")
public class Book {
private String id;
private String title;
private String author;
private String description;
private String cover;
// Getters and setters below.
}
遵循上述过程后的最终结果:我没有在 MongoDB 中插入遵循上述结构的记录,而是最终得到一个包含_id
and的字段_class
。
关于为什么会发生这种情况的任何想法?