I try simple CRUD in Spring Boot with Mongodb. I have problem with id number. How can I auto increment id. I tried but couldn't do it
Is there any simple auto increment way?
Controller
@Autowired
EmployeeRepo repo;
@RequestMapping(value = "home", method = RequestMethod.GET)
public String getHomePage(Model model) {
Employee employee = new Employee();
employee.setId(1);
employee.setName("deniz");
employee.setPassword("123");
repo.save(employee);
...
Employee
@Document(collection = "Employee")
public class Employee {
@Id
private long id;
private String name;
private String password;
// getter and setter