Chapter 5: Miscellaneous Aggregation ($indexStats and $collStats missing from the course)

As per screenshot below, Chapter 5 states its course content includes $collStats and $indexStats, however the lectures in this chapter don’t cover these 2 topics. They cover $redact, $out, and Views, but not $collStats and $indexStats

image

Furthermore, Final Exam has a question asked that requires knowledge of $indexStats.

@PuneetC

The point of Chapter 5 is to cover various Miscellaneous Aggregation commands – in this case, the curriculum team decided that $redact was more useful and more important than the statistics tools. I’m sorry if that confused you but that’s their decision.

What question in the Final Exam did you think needed $indexStats? I didn’t need that for any question myself. LMK.

I understand $redact is more useful and important than Stats tools like $indexStats and $collStats, however, the contents of this chapter needs to be updated to accommodate the change which the curriculum team decided upon. It still refers the contents as $indexStats and $collStats and doesn’t include $redact. (as per my earlier screenshot)

Furthermore, to answer your question, following question in final exam uses $indexStats

Final: Question 1 - Pipeline 3 uses $indexStats

db.coll.aggregate([
{
“$facet”: {
“averageCount”: [
{"$unwind": “$array_field”},
{"$group": {"_id": “$array_field”, “count”: {"$sum": 1}}}
],
“categorized”: [{"$sortByCount": “$arrayField”}]
},
},
{
“$facet”: {
“new_shape”: [{"$project": {“range”: “$categorized._id”}}],
“stats”: [{"$match": {“range”: 1}}, {"$indexStats": {}}]
** }**
}
])

and its corresponding option which states,

  • Pipeline 3 fails because $indexStats must be the first stage in a pipeline and may not be used within a $facet

@PuneetC

I agree that the description should match the actual contents, and I would encourage you to use the “Report an issue” tab at the bottom of the screen to tell the curriculum team directly about these two issues.

And thanks for pointing out the Final Exam question that asks about $indexStats. In that case, I will write myself directly to the head of the curriculum team and let her know about the issue. That seems to me to be quite unreasonable, to ask a question about a topic that hasn’t been covered, even if it can be found with some research in the documentation. Students should be able to answer all the Final Exam questions with the information provided in the Lectures.

I can point you in the direction of more questions in the Final Exam, where the topics were not covered during the course.

  1. Final Exam Question 1:
    Pipeline 1 : Here $replaceRoot was not covered in the course
    db.coll.aggregate([
    {"$match": {“field_a”: {"$gt": 1983}}},
    {"$project": { “field_a”: “$field_a.1”, “field_b”: 1, “field_c”: 1 }},
    {"$replaceRoot":{“newRoot”: {"_id": “$field_c”, “field_b”: “$field_b”}}},
    {"$out": “coll2”},
    {"$match": {"_id.field_f": {"$gt": 1}}},
    {"$replaceRoot":{“newRoot”: {"_id": “field_b", "field_c": "_id”}}}
    ])

  2. Final Exam Question 2:
    Pipeline 3 - Here $$ROOT was not covered in the course.
    db.collection.aggregate([
    {"$project": {“a”: {"$max": “$a”}}},
    {"$group": {"_id": “$$ROOT._id”, “all_as”: {"$sum": “$a”}}}
    ])

Although, Chapter 0 under Lesson: Aggregation Structure and Syntax does explain (as per screenshot below) the three types of variables, and that they are preceded with a $ sign. A System Variable will be preceded with $$ and will be in Upper Case, whereas, a user variable will be preceded with $$ but will be in lower case. So based on this, the only thing that I could derive was that $$ROOT in this question is some System variable. However, what is the use / utility of $$ROOT, what value does it hold etc. was not something that I was aware of, as this wasn’t covered in the course.

Since M121 course comes under the BASIC level category, hence I would have expected the questions to be directly related to what was covered in the course. In fact, M201 is an INTERMEDIATE level course, but still has all its questions based on what is covered in the course.

Nevertheless, I was able to reference the Mongodb documentation wherever I was stuck, and I am sure that’s what other course-takers must have done when they encountered questions on topics that weren’t covered.

1 Like