Assignment 12: NoSQL
06.07.2011 ! 11.07.2011
Exercise 1: MongoDB Shell !!!!!
This time we use the MongoDB Shell for executing the MapReduce framework
(same as Assignment 10, Exercise 2) of MongoDB. Start your MongoDB
Database and connect to it with the MongoDB Shell.
a) Use the mongoimport tool to import the JSON object from wood.txt (see
asg12.zip) into your db/collection named “group#/data”.
b) Define the map function, which removes punctuation and converts the
input to lower case. Further it tokenizes the input and emits each word
with the count 1.
c) Define the reduce function, which counts the frequency of the words.
d) Run the MapReduce function of MongoDB with your defined functions and
dump out the results to a collection named “mapResults”.
e) Print the content of “mapResults” in descending order by their value to
Please insert all MongoDB commands from b) – e) into a script named
mongoc.txt. You can test it with the command: “mongo < mongoc.txt”.
Exercise 2: Questions !!
a) Explain the NoSQL concepts replication and sharding.
b) What is vertical and horizontal scalability? When would you choose
scaling out and when scaling up? Give one example each.
c) db4o gives you three possibilities of querying, Query By Example (QBE),
Native Queries (NQ) and Criteria Queries (SODA). Describe the three
different approaches and discuss advantages and drawbacks.
Exercise 3: Feedback !
I'm interested in your personal opinion on the tutorials. Honest feedback is
• What have you missed?
• Regardless of the upcoming test: Which exercises seemed most
interesting and most useless to you?
• Looking back, would you attend this course again?
Christian Grün, Marc Scholl, Andreas Weiler Assignments
Databases & Information Systems Group Summer 2011
University of Konstanz Advanced Database Technologies