M101j Homework Help

 

Courseware (/courses/10gen/M101J/2013_October/courseware) Course Info (/courses/10gen/M101J/2013_October/info)Discussion (/courses/10gen/M101J/2013_October/discussion/forum) Wiki (/courses/10gen/M101J/2013_October/course_wiki)Progress (/courses/10gen/M101J/2013_October/progress)

SEARCH

M101J: MongoDB for Java Developers

Homework: HW 3.1

Download the students.json (/static/m101j-october-2013/handouts/students.432aefc2cf4e.json) file to your computer and import itinto your local Mongo instance with this command:

$ mongoimport -d school -c students < students.json

This dataset holds the same type of data as last week's grade collection, but it's modeled differently. You might want to start byinspecting it in the Mongo shell.Write a program in Java that will remove the lowest homework score for each student. Since there is a single document for eachstudent containing an array of scores, you will need to update the scores array and remove the homework.Hint/spoiler: With the new schema, this problem is a lot harder and that is sort of the point. One way is to find the lowest homework incode and then update the scores array with the low homework pruned. If you are struggling with the Java side of this, look at the ArrayList.remove method, which can remove stuff from a Java ArrayList. Note also that when the value for a particular key is list withinMongoDB, the Java driver returns a BasicDBList, which can you cast to an ArrayList.To confirm you are on the right track, here are some queries to run after you process the data with the correct answer shown:Let us count the number of students we have:

> use school> db.students.count()200

Let's see what Demarcus Audette's record looks like:

>db.students.find({_id:100}).pretty(){"_id" : 100,"name" : "Demarcus Audette","scores" : [{"type" : "exam","score" : 30.61740640636871},{"" ""

(/)

Courses (/courses)Help (/help) About (/about)Blog (http://ed-blog.mongodb.com/)DMAKETAS (/DASHBOARD)

Так вот какова месть Танкадо. Уничтожение ТРАНСТЕКСТА. Уже несколько лет Танкадо пытался рассказать миру о ТРАНСТЕКСТЕ, но ему никто не хотел верить. Поэтому он решил уничтожить это чудовище в одиночку. Он до самой смерти боролся за то, во что верил, - за право личности на неприкосновенность частной жизни.

0 Thoughts to “M101j Homework Help

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *