MongoDB returns an empty list when run with Spring Boot Framework

58 Views Asked by At

When i run my spring boot application it returns an empty arraylist which i'm at alas on what is going on, because everything looks correct to me, here are my codes Checkout the images of the classes below

Movie Class From the movie class you can see that i have include all the annotations required

Controller Class From the controller class i know it works because when i include <List>("Movie", HttpStatus.OK); it actually returns the string Movie

Repository Class

Service Class The results of what i am getting

I am positive that there is data in the database Database

Someone please help

1

There are 1 best solutions below

0
On

spring-data derives the collection name from the class name. Try to re-name your collection to "Movie" (as your class name) OR change the class name to "Movies" (as your collection name). In mongodb try to set your collection name same as your class name including small and capital letters.