Chapter 3 Lab - Using $lookup

Hi again :raised_hand_with_fingers_splayed:

I’ve successfully completed the lab, but with the “detailed answer” came more questions as I started comparing it to my approach…

  1. Why do we need an $unwind stage for instance? Does it fulfill the sole purpose of converting the “alliance” array into a string? We know an airline can only belong to one alliance, so is a new stage really necessary?
    My approach on that was to just create a new field in a $project stage to trim the documents using the $arrayElemAt method in order to get back a string from the alliance array, since it seemed more memory-efficient to me and allows to trim down documents to the bare needed minimum… Does my logic makes any sense?

  2. This one has to do with the formulation of the lab: " Which alliance from air_alliances flies the most routes with either a Boeing 747 or an Airbus A380 (abbreviated 747 and 380 in air_routes)?".
    I personally found it misleading, since it is not clear if the airplane should be exclusively or inclusively a 747 or 380: The term “either” kind of leads one to think it’s exclusive and that the route should only feature one of them, while many routes feature a few different airplanes, and using the regex as everyone else, I found out that routes matching /747|380/ also displayed other airplanes…
    So maybe something along the lines of “Which alliance fly the most routes using a Boeing 747 or an Airbus A380 amongst the route airplanes (abbreviated 747 and 380 in air_routes)?” would be a tad more specific. English is not my native language so don’t take my word(ing) for it, but you get the idea. On my end I was actually planning to test the different possibilities, but hey, I got lucky the first time :tada:

  3. This is a more general thing, but I feel it would be nice to add a connection string to the lab to allow one to connect to the database through Compass… I messed around with the provided connection string but wasn’t able to connect that way :confused:
    I unfortunately don’t have a deep enough understanding of how one should write connection strings (not talking about URIs, which have a very clear structure but unfortunately don’t work sometimes…)

In any case, this was a cool and challenging exercise, thanks to the team :slight_smile:

1 Like

Hi @Theophile_Louvel,

First of all I agree many questions across several exercises are confusingly worded, its difficult to answer without having an opportunity to elicit the question. I’m really worried about certification exam with such confusing questions.

When you supply a field path to $unwind it does not output documents with field value as null, missing or empty array, which is a default behavior and essentially this is equivalent to below $match pipeline, for this dataset:

$match: {
“alliance”: { $ne: }

I have a created a .bat file with the connection string which makes it easy to connect to mongo shell or you can add a connection to MongoDB Compass.

Hope this helps.


1 Like

Hi @Theophile_Louvel @Shravan,

Thanks for sharing your feedback!!

We are working on revamping our courses and we will soon launch the Aggregation Framework course where we are trying our best to incorporate user feedback.

In certification exam, the questions are worded in a way that is easy for users to understand and there are no complicated problems.

If you have any issues related to Course content, I highly recommend you to post your queries in the forum for clarification.

Please feel free to reach out if you have any questions.

Kind Regards,