Homework 2 1 Mongo Db Logo

There are several problems in your for loop - though your aggregation looks good.

Your result document "x" contains an array field "result". You want to iterate over the documents in that array. The for loop syntax you have won't set a to values in the array but rather to indexes in the array. Better and clearer would be to use forEach loop syntax:

Your update statement wasn't quite accurate either - you want to make sure you pull only the homework with the lowest score - what if the same student had a single exam which was also the same score as their lowest homework? Your syntax would pull all subdocuments which have the score equal to minscore!

That one is easy to fix (and I show you the syntax you need to use to only pull homework subdocuments), but remember that $pull will pull all values that match the query, and if there was only one homework then it's the minscore and it will get pulled. And if there were two homework scores but they were equal, they will both get pulled! Something to consider.

This is an advanced course for operations staff and others interested in administering MongoDB deployments. It is a deeper dive into many of the topics of M102 and several additional subjects. In this course, we will explore performance and monitoring with a detailed tutorial on using MMS. You will learn the mechanics of MongoDB memory and disk usage and how to tune Linux for typical MongoDB workloads. We will look at preparing for disaster recovery under different requirements scenarios ranging from low tolerance for downtime and data loss to high tolerance for both. You will also learn best practices for doing rolling upgrades and other maintenance across replica sets. Building on the introductory coverage of sharding in M102, we will cover sharding mechanics in detail and specific topics such as pre-splitting data and tag-based vs. hash-based sharding. Throughout the course, we will spend considerable time on diagnostic concerns and debugging configuration and other issues in MongoDB deployments. New MongoDB 2.6 features will be addressed throughout the course, including the new security features, which we will cover in the final week. 

This course should also prepare you to take the DBA certification associate exam. Register for next exam session to become a MongoDB Certified Professional.




Leave a Reply

Your email address will not be published. Required fields are marked *