I'm trying to develop a simple crud application using Spring and Mongodb.
When I'm trying to develop view single data function, I get no error.
But it return value as null when I try in Postman.
Could you please help me to find what is the wrong with my code?
Controller
@GetMapping("/patient/{id}")
public Optional<Patients> findTicketById(@PathVariable("id") @NotNull String id){
System.out.println(id);
return patientRepository.findById(id);
}
Repository
@Repository
public interface PatientRepository extends MongoRepository<Patients, Long> {
Optional<Patients> findById(String id);
}