From brand guide: https://flsouthern.mediavalet.com/portals/fsc-brand-guidelines
CSC 3340: Databases
(Fall 2024)

Syllabus

LMS

Teachers


Assignments


Other Pages

Project 7:
AggreGeorges


Assigned: Wed Nov 20 2024
Due: 11:59:00 PM on Fri Dec 06 2024
Team Size: 1-2
Language: Python 3 and MongoDB (using PyMongo)
Out of: 100 points


In this project, you'll create lists of MongoDB aggregation stages to return specified lists of documents (in Python dictionary form). When you finish a part, you can test a subset of my final tests by downloading this tester script to the same folder as your code and running it. (Test early and often!) It doesn't guarantee a grade, but will run some of the tests I will run when grading.

Part 0, 20 points: Write a function, get_all_monarchs_aggregation_list, that returns a list of pymongo aggregation stages that will fetch a cursor of all monarchs in your database. This should only include royals who spent time on the throne. I will test your code by executing it in this way:

>>> collection.aggregate(get_all_monarchs_aggregation_list())

Part 1, 15 points: Write a function, get_all_monarchs_in_order_aggregation_list, that returns a list of pymongo aggregation stages that fetches a cursor of all monarchs in your database, in the order of when they were on the throne. (If two monarchs started in the same year, the one who lasted longer should come later.) I will test your code by executing it in this way:

>>> collection.aggregate(get_all_monarchs_in_order_aggregation_list())

Part 2, 20 points: Write a function, get_queens_full_names_aggregation_list, that returns a list of pymongo aggregation stages that fetches a cursor of the full names of all queens in your database that were on the throne. It should not return the whole object! Just the full name (and an _id).

Part 3, 20 points: Write a function, get_royal_names_of_monarchs_with_single_name_aggregation_list, that takes a name (string) as a parameter and returns a list of pymongo aggregation stages that fetches a cursor of the royal names of all reigning monarchs that have that string in their full name. It should not return the whole object! Just the royal name (and an _id).

Part 4, 15 points: Write a function, get_royal_names_before_year_aggregation_list, that takes a year (integer) as a parameter and returns a list of pymongo aggregation stages that fetches a cursor of the royal names of all monarchs that started their reign before that year.

Part 5, 10 points: Write a function, get_royal_names_in_century_aggregation_list, that takes an integer as a parameter and returns a list of pymongo aggregation stages that fetches a cursor of the royal names of all monarchs who reigned during that century. As a reminder, the Xth century ends in the year X00.

Submitting your Project:

Choose a team name that no other team will choose. Then make sure all your code is in a file labelled with your team name, followed by _project7.py all in snake_case. (For example, my file name would be: kburke_project7.py.) It's very important to name your file correctly in order for me to grade it. Make sure your code runs, then upload it to the project on Canvas. If there is already a file up on Canvas, I recommend deleting that before uploading the new version. If you submit well before the deadline, send me a message on Slack. If there's adequate time, I'll check it and post feedback on Canvas. If you submit after the deadline, please message me so I know I have something late to grade.