Filtering Movies by Genre

Learn how to retrieve data based on a genre ID from MongoDB.

Filtering movie logic

This functionality enables users to browse movies that fall under a specific genre. All we need to do is send the genre_id to search in the database for movies.

Setting up the controller

We need to configure a controller to communicate with the service, router, and database. The SearchMovieByGenre() controller locates movies that fall within a particular genre. Therefore, all we need to do is supply the genre_id as an input, and then the system will automatically search for movies that contain the genre_id in their information.

Get hands-on with 1400+ tech skills courses.