架包依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
</dependency>
两表的话就两个实体
实体类
@Data
@Document(collection = "student")
public class Student implements Serializable {
@Id
private Integer _id;
private String name;
private String sex;
private Integer gredid;
// private grade grade;
}
@Data
@Document(collection = "grade")
public class grade implements Serializable {
@Id
private Integer _id;
private String name;
dao层
public interface StudentDao {
/**
* 添加
* @param student
*/
void save(Student student);
/