HW13: MongoDB due Wed 19 Apr 13:00

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

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.