MongoAssignmentsAhead

code > F:\mongodb\> mongod --dbpath data > code > code F:\mongodb\> mongoimport -d test -c zips < zips.json code code >> use test >> 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 code >> db.zips.find({pop : 8000}).count >> code
 * 1) Download the zip code database and save the file to your mongodb folder the file name should be [[file: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
 * 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.
 * 8) Start mongo shell (mongo.exe)
 * 9) Switch to the test database
 * 1) //Q1: How many documents are there in the zips collection (run the command below)?//
 * 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 in. Q4: What command would your run to find out how many supers you have in your database?
 * 2) Switch back to the test data base
 * 3) Here is one record from the zips database
 * 1) //Q5 : Why does the a ZIP code get quotes but (pop)ulation doesn't?//
 * 2) If you wanted to look at towns have a population of 8000 then you would use the code below.
 * 1) If you wanted to count the number of ZIPs that serve a town with a population of 8000, then you would run
 * 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)//