HW13: MongoDB due Wed 17 Apr 13:00

\begin{purpose}
This assignment provides practice with MongoDB.
\end{purpose}

Allowed and Disallowed Resources

In completing this assignment you MAY use/access the following resources:

You may NOT use/access:

Failure to abide by these guidelines will result in a zero for the assignment and the incident will be reported to the university provost as a violation of the university academic integrity policy. A second incident of academic dishonesty (whether from this course or another computer science course) will result in an F in the course.

Overview

Create a text file (named hw13.js) containing MongoDB commands that when executed will establish a collection named “patients” in a database named hw13. You will populate the collection with documents and then query, update, and delete entries in accordance with the instructions below.

The final script should begin with a command to remove all data from the patients collection so that each time it is run there is a clean starting point. The hw13.js file should be executable by the provided mongoexec script on csci.hsutx.edu.

What hw13.js Should Include

The patients collection will contain documents that have this general structure:
{
   "firstname": "Fred",
   "lastname" : "Smith",
   "age": 29,
   "history": [
      { "diagnosis": "flu", "treatment": "Tamiflu" },
      { "diagnosis": "inflamed nostrils", "treatment": "nostril de-infamer" }
   ]
}

Suggested Workflow

A pretty efficient workflow would be for you to have two terminal connections to the csci server. In one window have a shell command open to the database and in the other work on editing hw13.js. In the database shell try commands until you get something that works and then copy that working command into hw13.js. Every so often use the mongoexec script to run the commands in hw13.js and verify they are doing what you want.

Grading and Submission

Upload your script (with .js extension) into canvas. The script should include commands to execute the queries/functions described above.