- Welcome to M101J
- What is MongoDB?
- MongoDB Relative to Relational
- Overview of Building an App with MongoDB
- Quick Introduction to the Mongo Shell
- Introduction to JSON
- System Requirements
- Installing MongoDB (mac)
- Installing MongoDB (windows)
- Installing and Using Maven
- Intro to the Spark Web Application Framework
- Intro to the Freemarker Templating Engine
- Spark and Freemarker Together
- Spark: Handling GET requests
- Spark: Handling POST requests
- MongoDB is Schemaless
- JSON Revisited
- JSON Subdocuments
- JSON Spec
- Introduction to Our Class Project, The Blog
- Blog in Relational Table
- Blog in Documents
- Introduction to Schema Design
Install MongoDB on your computer and run it on the standard port.
Download the HW1-1 from the Download Handout link and uncompress it.
Use mongorestore to restore the dump into your running mongod. Do this by opening a terminal window (mac) or cmd window (windows) and navigating to the directory so that you are in the parent directory of the dump directory (if you used the default extraction method, it should be hw1/).
Now type:
mongorestore dump
Note you will need to have your path setup correctly to find mongorestore.
Next, go into the Mongo shell, perform a findOne on the collection called hw1 in the database m101. That will return one document. Please provide the value corresponding to the "answer" key from the document returned.
R:
42
R:
{ "name" : "Fred Flinstone" ; "occupation": "Miner" ; "wife" : "Wilma" }
{ "city" = "New York", "population" = 7999034, "boroughs" = ["queens", "manhattan", "staten island", "the bronx", "brooklyn"] }
√ { "title" : "Star Wars", "quotes" : [ "Use the Force", "These are not the droids you are looking for" ], "director" : "George Lucas" }
√ { "a" : 1, "b" : { "b" : 1, "c" : "foo", "d" : "bar", "e" : [1, 2, 4] } }
√ {}