Designing a MongoDB database for movie details and reviews
This report is based on the case study and the solution of the Movie Maniac Site. They provide the details of the movies to their follower, now they want to provide the details of the movies to their followers and they also want to get the reviews and the ratings of movies and store them in their database and then they can display those reviews such as ratings and comments to their follower. For that they wanted to design a database to store the details about the movies which includes the movie title, director of the movie, lead actors of the movie, release date of the movie, number of Oscars won by the movie and the country of the movie, now they want to store the reviews for the movie, a movie can have multiple reviews, reviews can be given by a user.
MongoDB is a No SQL database. It is an open-source, cross-stage, report situated database written in C++.
Our MongoDB instructional exercise incorporates all themes of MongoDB database, for example, embed archives, refresh reports, erase records, inquiry records, projection, sort() and farthest point() techniques, make accumulation, drop gathering and so on. There are additionally given MongoDB inquiries to enable you to all the more likely comprehend the MongoDB database.
MongoDB is used for the storing the information about the movies, as MongoDB stores, the information in the form of the document, in this scenario movie document is prepared for each movie, the structure of the document contains the information about the movies.
- A movie has a unique id which is an integer type named the movieId.
- A movie can have series so it can have multiple titles series wise for that we can have a title field in the database which can be a list of string, it can have multiple titles as well as a single title of the movie.
- A movie has a director but there is mentioned that there could be multiple directors for that we have field director name in the document that is a list of string. It can contain multiple directors or a single director.
- Every movie has some actors and the no of actors is most of the time be multiple, for storing the information of the actors worked in the movie we have a field name actors which type is list of strings, it contains the name of all the leading actors of the movie.
- Movie won awards in movie fests. Oscar is world famous award show in the movie industry, movie can win Oscar awards more than one in many categories. For Oscars, there is a field name Oscars which is integer type that contains the number of Oscars won by the movie.
- The movie is released on a specific date in a year, thus we need to store the Release Date of the movie for further records. There aisre releaseDate field for storing the release date of the movie, which is integer type which contains the release year of the movie.
- Movie maniac owners want to provide the functionality to the users to submit their reviews about the movies so that it will help to other users to pick the movie of their choice and they can pick the movie based on the reviews given by the users.
A movie can have multiple reviews, that would be given by the users, for that user only need to submit his/her name along with the rating out of 10 and the comment about the movie.
Thus reviews would be a list that contains multiple objects that have the name of the user, rating out of 10 and the comment about the movie.
Structure of the movie document would look like this….
{
“movieId” : 1,
“title” : [
“2001”
],
“director” : [
“Stanley Kubrick”
],
“actors” : [
“Daniel Richter”,
“Gary Lockwood”,
“Keir Dullea”,
“William Sylvester”
],
“releaseDate” : [1968],
“oscars” : 1,
“country” : “USA”
“reviews” [
{
“name”: “Mike”,
“rating”: 6,
“comment”: “Fantastic movie.”
},
{
“name”: “Pike”,
“rating”: 9,
“comment”: “Just Awesome.”
}
]
Indexes are used in the database to access data or information very easy way, indexes are just like the book indexed if you want to query some information indexes are used to start the searching from the appropriate record and not all records. In this database release date of the movie, a field is being set to index. It will help us to find the record very easily. If we want to display only the movies released before 1980 then index what will do is it will not search for all the records and check them whether it has been released before 1980 or not but it will sort the movies and start searching for some record and not all.
Here releaseDate field is set to indexed for retrieving the data from the query with high performance it depends on the collection to collection weather a single key index is good or compound indexing is better, here is single key index is used to improve the performance. Sometimes compound indexing is better sometimes single, single indexing is used to save the space.
To implement the database insert method is used, instead we can use insertMany for inserting many documents into the collection at a time, ot insertOne for inserting single document at a time. If we want to update a document, update method is used, save method does the thing like if the document is already available in the collection then it updates the document and if there ais no document then it inserts one.
There are many alternatives are available in the market to the MongoDB, some are written below.
- Cassandra:- Apache is an open source, scalable, non-relational database. Cassandra is able to scalable while still being reliable, it is easy to deploy over multiple servers.
Benefits:
- Open Source
- Elastic Scalability
Issues:
- Read time degradation
- Failed Operations
- CouchDB:- Database consistency that is based on bi- directional replication, it is best for web applications that handled the huge amount of data.
Benefits:
- Fast indexing and retrieval
- Consistancy
Issues:
- Not designed for frequently update the data
- Doesn’t have built-in full text search
- MySQL:- The leading database choice for web-based apps, optimized for web apps, can scale to thousand query per second nut some issues with stability and clustering.
Benefits:
- Data Security
- On-Demand Scalability
- High Performance
Issues:
- Stability Issue
- Poor performance Scaling
We realize that MongoDB is a pattern less database. That implies we can have any sort of information in a different archive. This thing gives us adaptability and a flexibility to store information of various sorts.
We can store a vast information by conveying it to a few servers associated with the application. On the off chance that a server can’t deal with such a major information at that point there will be no disappointment condition. The term we can use here is “auto-sharding”.
MongoDB is a record situated database. It is anything but difficult to get to records by ordering. Consequently, it gives quick question reaction. The speed of MongoDB is 100 times speedier than the social database.
- Join not supported.
- High memory use
- Limited Data Size
- Limited Nesting
- They can store the poster of the movies and display them to user.
- They can store the backstage stories happened during the shooting time of the movie.
- They can store facts about the movies which user don’t usually get to know.
- They can add the genre to the movies.
References
Okore, S. and Bakyarani, E. (2015). Big Data Personal Health Records Management and Analysis on Cloud Using No SQL-Mongo DB. International Journal of Computer Trends and Technology, 28(2), pp.68-74.
Okore, S. and Bakyarani, E. (2015). Big Data Personal Health Records Management and Analysis on Cloud Using No SQL-Mongo DB. International Journal of Computer Trends and Technology, 28(2), pp.68-74.