MongoDB Query - Assignment
MongoDB 是一款广泛使用的 NoSQL 产品,拥有灵活的数据模型以及良好的可扩展性。本作业的内容是根据要求撰写 MongoDB 查询语句。
Reading the Dataset
● You are provided with a JavaScript file (movies.js) that contains an insertMany command and thus creates a collection called ‘movies’ with the given data.
● Using the load command from the mongo shell, you should be able to load the dataset.
Question 1: Co-participation of actors in movies [10 marks]
List all the actors who have worked with Natalie Portman in more than one movie. Indicate also in how many movies, and the years they have worked with her.
Question 2: Versatile actors [10 marks]
List the four actors who worked in the largest number of movie genres. Show both the genres they have worked on and the number of genres
Question 3: Timespan of actors [10 marks]
List the four actors who have been acting for the largest number of years. Show the number of years, as well as the first and last year they have acted.
Question 4: Critically acclaimed directors according to Metacritic [10 marks]
From the directors who have produced more than three movies, which have a Metacritic score, list the top four directors whose movies have the highest average Metacritic score. Show the director names, the average Metacritic score, and the number of movies with a Metacritic Score they have directed.
Question 5: Finding popular movies that you’d like [10 marks]
This question requires a single query (aggregation) where you should do the following:
● Identify the types of movies that you generally enjoy.
● Compute a field the uses the information of the audience popularity of movies (i.e., general viewers as opposed to specialised critics).
● Compute also a field that contains the sum of awards and nominations the movies have received.
● List the top 5 movies that you would enjoy, sorted according to the popularity information you gathered.
● Show the title of the movies, the year they were produced, the audience popularity and the sum of awards and nominations you computed.
咨询 Alpha 小助手,获取更多课业帮助。