Project 6: Design and implement a simple database-backed program using a modern ORM tool.
Project 6.3: Take one entity from the domain and persist the data to a document-oriented database in the cloud, using an ODM.
"hey. hey. hey you. hey, get up. HEY!"
Your eyes open to find your roommate standing over you. "Hey, sorry, but you're going to be late for your database class." he says. "There was a note on the fridge telling me to wake you up, so don't hate me, you asked -- ew, gross! What's that blue stuff all over your mouth?"
"I uh... I dunno, I must have been chewing on a ballpoint pen while hacking last night," you lie. The strong taste of blueberries still lingers in your mouth. Could this all have been real? It must have been a joke. "The Mines? Come on," you think, "There's no such thing."
"Well, anyway, I'm off to class too, want to walk together?" he asks, and you nod.
Along the way to campus you tell your roommate about what had transpired over the past few weeks. He shakes his head with disbelief.
"I don't know... I mean... c'mon... a grey banana phone? Why would these super-hackers want you anyway? And you have got to choose a cooler hacker alias. Seekwell? C'mon. How about DeathSpider or something?"
You take a deep breath and sigh. "I'm not sure what to believe any more," you reply. "I think I'm having homework-induced hallucinations. Anyway, see you later."
The whole experience leaves your head swimming. Relational or NoSQL? And even more important is the database you saw in The Mines. Could people really use NoSQL databases like that? How can I change my application, leaving a well-designed relational database schema for a schemaless NoSQL database? So many questions....
For this assignment, you will be exploring the use of MongoDB, a document-oriented database. This database server is being hosted for you on the AWS cloud infrastructure. Your basic requirement is simple. Given this boilerplate program, complete the implementation such that it displays a list of animals stored in the database. When complete, your program should display a screen that looks like this:
You will need to implement an Animal class that includes the MongoMapper Document API (via include MongoMapper::Document). For this part of the assignment, you should only implement three keys (attributes): name, description and cuteness. Be sure to try to figure out how to make the name attribute a required attribute. (Do not worry about other constraints.)
Now that you have a simple test working, it's time to revisit your previous Zoolicious simulator and retrofit your work to use a MongoDB datastore. Here is a stub implementation to get you started, which I recommend you use rather than your completed work from project 6.2.
Remember, MongoDB is not a relational datastore, and MongoMapper is not an ORM! Furthermore, MongoDB is "schemaless" so refer to the original ERD as a guide (note that we added first_name and last_name to our schema, so be sure to include and display these User attributes.)
Notice the comments in the program -- the data you display is much more simple than your previous iteration in Project 6.2. However, be sure to spend some time exploring how MongoDB and MongoMapper model relationships, as you will need to establish a relationship between Animals and Habitats. During this process, you'll notice some fundamental differences between "relational relationships" and document relationships.
Lastly, have fun with this! We are all using the same data store, and I encourage silly data (just try not to be too offensive). The one thing I ask is to not delete any data, since I have seeded the db with some data for you.
Attach (do not copy & paste) a .zip of your zoomongo.rb and zoomongo_main.rb to your submission in Blackboard.
Note that no submissions will be accepted after Monday, May 7.