M121, Chapter 3, Lab $graphLookup: none of the solutions are correct

The requirements say that we should “Include both the destination and which airline services that location”. The answer that is marked as correct does not include this information. It outputs only the destination.

Edit:

Also, the solution marked as correct returns 158 documents, as hinted. But it follows a requirement that is NOT in the problem statement: that we use the given airlines for ALL routes. The instructions only say we should start from the base of certain airlines, but not that we cannot fly with other airlines. The answer that fits the instructions exactly (except for not returning the airline as noted above), returns 450 documents, not 158, and is marked as incorrect.

Hi @Bart_Sturm,

Yes, the output isn’t correct.

But respect to the second paragraph, the key point is the word “distinct”. Just in case this is helpful:

  • A -> B -> C
    and
  • A -> D -> C

Should be grouped into one, because that’s only 1 “distinct” destination.

When I don’t group those, I get 450.

1 Like

Thanks a lot Santiago, I must have misread the difference between the two algorithms.

Good to see this! I was not the only one to think the same thing!

Also of you get rid of the line:
{$match:{isValid:true}},
you get 450.