MongoAssignments

**Week 6**

 * 1) In a complete change in direction, we are going to look at Replica Sets. This is a way for the database to duplicate itself across several Mongod processes.
 * 2) The museum database will be a three repl set, in case something happens to one machine the other two can carry the load.
 * 3) Again there is a deeper level of video Week6 Videos.
 * 4) I'm going to hold off on the homework until we can get the MongoDB University Accounts.

**Week 5**

 * 1) Visit to MonogHQ Here is the final result: [[file:photo 1.JPG|Photo1]], [[file:photo 2.JPG|Photo2]],[[file:photo 3.JPG|Photo3]]
 * 2) Create a Schema for the object and story collections
 * 3) Share it with me, and we will post it here for the class to look at.
 * = Joshio ||= not submitted yet ||
 * = Merita ||= not submitted yet ||
 * = Stan ||= not submitted yet ||
 * = Konrad ||= not submitted yet ||
 * = Jayson ||= not submitted yet ||
 * = Thomas ||= not submitted yet ||
 * = Jonathan ||= not submitted yet ||
 * = Nicolae ||= not submitted yet ||

**Week 4**
>> together
 * 1) This week we are going to focus on the rest of CRUD. (C)reate, (R)ead, (U)pdate, and (D)elete are the main operations of any database.
 * 2) Create = insert or mongoimport in MongoDB
 * 3) Read = find you should already be OK with this, we will cover it in more detail soon
 * 4) Update = update in mongo, I know they actually have the same name.
 * 5) Delete = remove
 * 6) You have a long list of videos this week to chew through, but we will be in a good place after you get through it.
 * 7) Watch the videos, do the commands along with the instructor it helps.
 * 8) Make a list of things you don't understand, or you have trouble with, (THIS WILL BE A LONG LIST)
 * 9) At some point after our meeting with Bill, we need to have a longer discussion. Figure 20-30 minutes. I can work with more than one person at a time. I can set this up to be a 7am or a 9th period meeting, as well as, the normal school day meetings.
 * 10) We will go over your schema for the museum collections.
 * 11) We will talk about the concepts from the videos, and what you had trouble with
 * 12) Bring your flash drive and we will do some CRUD operations on your animals table

**Week 3**
code mongod --dbpath data code code mongoimport -d test -c zips < zips.json code code db.zips.count code code db.zips.find db.zips.find.pretty code code use comics code code { "_id" : ObjectId("531472b57053232d345d901"), "city" : "ACMAR", "zip" : "35004", "loc" : { "y" : 33.584132, "x" : 86.51557 }, "pop" : 6055, "state" : "AL" } code code db.zips.find({ pop : 8000}) code
 * 1) Download the zip code database and save the file to your mongodb folder the file name should be [[file:awoodbridge/zips.json|zips.json]]
 * 2) Start up mongod
 * 1) Import the zip codes into the test database, run the code below in a new command prompt window with the mongod running
 * 1) mongoimport is a utility to put data into a running mongod
 * 2) -d test means use the test database
 * 3) -c zips means use the zips collection
 * 4) zips.json tells import which file to use
 * 5) Import the **animals** data into the **test** database, **animals** collection (modify the statement above with the correct database, collection and file name)
 * 6) Import the **supers** data into the **comic** database, **supers** collections(modify the statement above with the correct database, collection and file name)
 * 7) Go look at your data. For the Q1-Qn below, please write your answers and submit them in an email. This is your work for the week.
 * Q1: How many documents are there in the zips collection (run the command below to find out
 * 1) See what the data looks like. //Q2: What is the difference between two commands below?//
 * 1) Since the database doesn't want to waste all it's power sending you bunch thousands of documents, it'll only send you 20, if you want to see more, just type IT then press enter
 * 2) Lets go look at the animals data, //Q3: What command would you use to look at all the documents in the animals collection?//
 * 3) To change to the supers database, type:
 * 1) Check to make sure your super data made it in. //Q4: What command would you run to find out how many supers you have in your database//
 * 2) Switch back to the test database
 * 3) Here is one record from the zips database
 * 1) //Q5: Why does a ZIP code get quotes but pop (population) doesn't?//
 * 2) If you wanted to look at the towns that have a population of 8000 then you would use the code below:
 * 1) //Q6: What would you run to find out how many zip codes are in Mississippi (MS)? and what is the result//
 * 2) //Q7: What ZIP Codes serve Olympia WA? (Tell me the command you ran and the result)//
 * 3) //Q8: What is the population of Ridgewood, NY?// (Tell me the command you ran and the result)//

**Week 2**
>> C:\mongodb\> mongod --dbpath data >> code >>> >>> >>> >>> >>> >>> *** You should get a bunch of lines of text that show the running database >>> >>> >>> >>> >>> >>> *** In NEW command prompt, again change to the mongo directory >>> >>> >>> >>> >>> >>> *** Start mongo C:\mongodb\> mongo code db.isMaster.maxBsonObjectSize code
 * Videos to Watch
 * [|JSON Types]
 * [|JSON Syntax]
 * [|MongoDB Shell]
 * [|MongoDB Shell & Queries]
 * Assignments
 * 2.1 To Make sure everything is running
 * Start a command prompt
 * Change to the mongo directory
 * Start mongod, using the command below. The --dbpath data makes the database use the data directory to store files in.
 * code format="python"
 * code
 * You should get a command prompt.
 * Show that the database is running correctly by typing this at the shell prompt. Email me the result right away
 * code
 * Close both windows
 * 2.2
 * We are going to build two different collections into our database to practice with: superheroes and sneakers.
 * I will get you started with some attributes, you need to add four more to each
 * Animals : Genus, Species, Tag Number, Diet (a list of the foods that it eats) + 4 more that you come up with
 * Superheroes: Name, Secret Idenity, Powers (a list of powers), nemesis + 4 more that you come up with
 * Have me check your schemas (the attribute lists) before you start making lists
 * We will setup the framework for the JSON document
 * In a text editor, make a list of 15- 20 superheroes and 15-20 animals with all the attributes that we can add to the database
 * Don't Use Word
 * Use Notepad (windows), or [|Notepad++] (windows), or TextMate (Mac)
 * Show me the file when you're done.

**Week 1**
C:\users\Zed> code
 * =Don't Panic=
 * Get MongoDB up and running on your computer. We are going to get into scary non-graphical text land, the "old way" of dealing with computers. It's new you will be ok
 * **MAC DIRECTIONS VIDEO**
 * Watch this video and do the best that you can. I would put mongoDB on a flash drive, so you can bring it back and forth from home to school
 * When you start the Command Prompt you'll see
 * code
 * This is the drive (C:), and you're inside your directory (folder) inside of the users directory (folder)
 * Commands
 * CD means Change Directory, CD.. goes backward.
 * DIR means directory and will show you all the files in the directory
 * MD means make directory.
 * Installing MongoDB
 * Download MongoDB from the website
 * Extract the files (using windows or winzip or something
 * Put the binaries in a folder called MongoDB on a flash drive
 * Go to computer and see what drive letter your flash drive is
 * Start Command Prompt
 * type E: (if your drive is E or F: if it is F etc)
 * your prompt should be //E:\>//
 * Type //CD mongodb//
 * Then your prompt should say //E:\mongodb>//
 * Type DIR to make sure the files are all there, there should be one called mongo.exe and one called mongod.exe,
 * Type //MD data//
 * Starting MongoDB
 * Type //mongod// then your database should start up
 * Leave this running and start a new command prompt
 * Go the mongodb directory (like above)
 * Type //mongo//
 * And you should be in the shell
 * If you can both programs running, then you did it. If not, email me for help
 * Watch a couple videos little on JSON & BSON. I expect that a lot of this will be over your head, but you will get something out of it.
 * https://www.youtube.com/watch?feature=player_embedded&v=gKOcqNHmc4Q
 * https://www.youtube.com/watch?feature=player_embedded&v=a3jWXcmjrWM
 * https://www.youtube.com/watch?feature=player_embedded&v=CEH0kNxVyMw