Using the mongod command, we will start the locally installed MongoDB and then using the following command, we will start the project we just created:
mvn spring-boot:run
Head over to postman and call the URL http://localhost:8080/movies (GET). You will see an array with zero elements in it. Now, call the URL http://localhost:8080/movies (POST), with the following JSON in the body:
{
"id": 1,
"title": "testtitle",
"genre": "thriller"
}
You will get a 200 OK status, and should see the newly created JSON as a response. Now, if you run the GET request on movies endpoint, you should see the newly created Movie as a response.
Here, we implemented CRUD in our Movie model by using MongoDB as a persistence store in a reactive programming paradigm.