Lab 3.1 Explain Output

Hello, I just created the index and compared the output from the lab and from my shell and they seem a bit different. It might be that the exam needs to be updated?

{
        "queryPlanner" : {
                "plannerVersion" : 1,
                "namespace" : "m201.restaurants",
                "indexFilterSet" : false,
                "parsedQuery" :"REDACTED",
                "winningPlan" : {
                        "stage" : "FETCH",
                        "inputStage" : {
                                "stage" : "SORT",
                                "sortPattern" : {
                                        "name" : 1
                                },
                                "memLimit" : 33554432,
                                "type" : "default",
                                "inputStage" : {
                                        "stage" : "IXSCAN",
                                        "keyPattern" :"REDACTED"
                                        "indexName" : "REDACTED",
                                        "isMultiKey" : false,
                                        "multiKeyPaths" : "REDACTED",
                                        "isUnique" : false,
                                        "isSparse" : false,
                                        "isPartial" : false,
                                        "indexVersion" : 2,
                                        "direction" : "forward",
                                        "indexBounds" : "REDACTED"
                                }
                        }
                },
                "rejectedPlans" : [ ]
        },
        "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 2877,
                "executionTimeMillis" : 19,
                "totalKeysExamined" : 2877,
                "totalDocsExamined" : 2877,
                "executionStages" : {
                        "stage" : "FETCH",
                        "nReturned" : 2877,
                        "executionTimeMillisEstimate" : 10,
                        "works" : 5756,
                        "advanced" : 2877,
                        "needTime" : 2878,
                        "needYield" : 0,
                        "saveState" : 5,
                        "restoreState" : 5,
                        "isEOF" : 1,
                        "docsExamined" : 2877,
                        "alreadyHasObj" : 0,
                        "inputStage" : {
                                "stage" : "SORT",
                                "nReturned" : 2877,
                                "executionTimeMillisEstimate" : 5,
                                "works" : 5756,
                                "advanced" : 2877,
                                "needTime" : 2878,
                                "needYield" : 0,
                                "saveState" : 5,
                                "restoreState" : 5,
                                "isEOF" : 1,
                                "sortPattern" : {
                                        "name" : 1
                                },
                                "memLimit" : 33554432,
                                "type" : "default",
                                "totalDataSizeSorted" : 163518,
                                "usedDisk" : false,
                                "inputStage" : {
                                        "stage" : "IXSCAN",
                                        "nReturned" : 2877,
                                        "executionTimeMillisEstimate" : 0,
                                        "works" : 2878,
                                        "advanced" : 2877,
                                        "needTime" : 0,
                                        "needYield" : 0,
                                        "saveState" : 5,
                                        "restoreState" : 5,
                                        "isEOF" : 1,
                                        "keyPattern" : "REDACTED,
                                        "indexName" : "REDACTED",
                                        "isMultiKey" : false,
                                        "multiKeyPaths" : "REDACTED",
                                        "isUnique" : false,
                                        "isSparse" : false,
                                        "isPartial" : false,
                                        "indexVersion" : 2,
                                        "direction" : "forward",
                                        "indexBounds" :"REDACTED",
                                        "keysExamined" : 2877,
                                        "seeks" : 1,
                                        "dupsTested" : 0,
                                        "dupsDropped" : 0
                                }
                        }
                }
        }
}

As it can be seen, the last stage in the winningPlan is a FETCH instead of the SORT stage, plus there is no SORT_KEY_GENERATOR stage.

Hi @Michael_Osorio

Thanks for flagging this, I’ve run this locally with a newer version (4.4) and there is similarly a different output. I believe the outputs for M201 were generated with MongoDB 3.6 and some of the explain fields may differ slightly. I’d suggest using that version of the shell and we’ll take note of your suggestion. I’ll raise this as an issue to be updated when we next work on this course.

Kindest regards,
Eoin