![]() | |
Project 5: Assigned: Fri Nov 08 2024 In this project, you'll create a database in MongoDB using PyMongo and add a collection with documents. Then you'll create some Python functions to manipulate the data in the database. While working on your code, you can run a subset of my tests by downloading this tester script to the same folder as your code and running it. Since it doesn't run all the tests that I will run, it's not a guarantee of the grade I'll give you. Nevertheless, it might help find some mistakes. Test early and often! Part 0, 10 points: Lakeland is known as Swan City, partly because of the prevalence of swans in the major lakes downtown. These swans are all descendants of a British swan donated to the city from Queen Elizabeth II! Let's pay some symbolic tribute and track some of the queen's history and ancestry. Create a new MongoDB database in PyMongo with your teamname. For example, mine is named 'kburke', so that would look like this for me: Part 1, 10 points: Add a document for Queen Elizabeth II. I looked up some information on Wikipedia that I thought was relevant. You need to have at least six fields, but the necessary ones are: Part 2, 20 points: Add documents for four more royals, who have these as their royal names: Part 3, 20 points: Write a python function, get_id_by_full_name(collection, full_name), which returns the '_id' field of a document with the given full_name. Part 4, 10 points: Write a python function, is_parent(collection, parent_name, child_name), which returns True if parent_name is the full name of a document that is the parent of the document with child_name as its full name. Part 5, 10 points: Write a python function, get_parent_names(collection, full_name), which returns a list of the full names of the parents of the royal with the given full_name. Part 6, 20 points: Write a python function, get_child_and_grandchild_names(collection, full_name), which returns a list of the full names of the children and grandchildren of the royal with the given full_name. If you haven't already, I highly recommend you add a children field to the document, similar to the parents field. 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 |