Resids and mango DB homework assignment
Homework 4: MongoDB
Run MongoDB Locally
Run a MongoDB instance on localhost so you can connect from a client
Task 1. Install MongoDB for you platform
1. Go to https://www.mongodb.org/downloads
2. Find you platform
3. Download
4. Follow the installer
Task 2. Run a server
If you are using windows and MongoDB is installed in Program Files you’d need to use Administrative role
1. Open command prompt as administrator
2. Navigate to MongoDB root
3. Create a folder “data”
4. Run “mongod –dbpath ../data”
Additional Information:
Here are some resources for installing mongodb on mac:
1) install homebrew ( http://brew.sh/index.html )
2) install mongodb with home-brew ( http://treehouse.github.io/installation-guides/mac/mongo-mac.html )
3) import restaurant data ( https://docs.mongodb.com/getting-started/shell/import-data/ )
4) I have tried the top 5 queries, and they look good.
To install mongodb on Windows:
To log what you are doing on Unix, please use the script command. Do a “man –k script” to learn more about the script command. The default filename is typescript that is created in the current working directory. You can get the output of script going to a different file by using the command line option.
For logging scripts on windows use powershell:
http://sharepointjack.com/2013/simple-powershell-script-logging/
I do not care which logging script or screenshot you use, but, I need some evidence that all the tasks identified below are done.
Task 3. Practice all of the following exercises
http://www.w3resource.com/mongodb-exercises/
Submit the screenshot. You should do the exercise first and only if you cannot do it, look at the answers.
Task 4. Insert the data that you inserted in your redis database in Hw3 into this MongoDB database.
Task 5. Upsert data (e.g., one record from the car sales website) into your MongoDB database. Perform the same data into your redis database.
Task 6. Query your data from both databases.
Task 7. Query aggregate data for a query of this type. Find me Audis that are under 50,000 miles being sold by a dealer in State College for under $20,000 on both queries. Feel free to change “Audis” to whatever car makes are in your database. Perform the query for one car make in your database and for one car make not in your database.
Submission:
Submit a log of your work. Include a short writeup (if necessary) to help us understand what you did.