1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to MongoDB in Python

Connected

Exercise

Bring it all together

You're building a "highlight reel" for a film app that showcases a few top-rated movies. Your goal is to retrieve the top 5 highest-rated movies released after the year 2000, but you only need to display the title and rating; nothing else!

To do this, you'll combine practically everything you've learned in this chapter; good luck! The mov collection is still available for you to use.

Instructions

100 XP
  • Fill in the filter so you only retain movies that have a release_year after 2000 (use $gt).
  • Use projection to include only "title" and "rating" (and exclude "_id").
  • Sort by "rating" in descending order and limit the results to the top five.