About Final Question 7

I used both collections to aggregate my pipeline. Found 4 unique for the company within air_alliances. But in air_routes collection my pipeline returns nothing? Am I doing something wrong?

Is it because I used $lookup for information from “air_routes” inside an aggregation stage?

@Burak_84129

Consider which collection you want to start from, and then which one you want to use for the join. I’m assuming here that when you say “the company” you mean the field ‘alliance.name’. It would clarify your question if you use the fully namespace field name to explain your question. Try that and I’ll try to help.

Yes I selected “air_routes” to join and I meant to say “alliance.name” but I assigned them “as planes” in $lookup stage.

@Burak_84129

OK, thanks for the clarification,

So the task here is to find the alliances that have the most routes between LHR and JFK, as shown in the air_routes.src_airport and air_routes.dst_airport fields.

You’re starting with air_routes. That’s a good start, since it has almost 67000 documents compared to air_alliances 3. Generally, in a large collection, you want to start by selecting out the relevant documents with a $match stage. Once you’ve done that, then you can use the $lookup to cross-reference the results with air_alliances and process the final result to get your solution.

And there’s nothing in that sequence that would prevent you from using the results of $lookup in an aggregation stage. HTH.

Ok so I tried again and I found 4 unique value again for that alliance. I’ll take my last chance again with this answer. Thank you David :slight_smile:

Came across this link…

I suggest the question here should be re-framed, so as to ensure that while building our aggregation pipeline, we filter only on direct flights by the unique carriers(airlines) between JFK and LHR, in both directions. We are not supposed to be considering any stop-overs here…

Original Question:
Using the air_alliances and air_routes collections, find which alliance has the most unique carriers(airlines) operating between the airports JFK and LHR , in both directions.

Should be changed to:
Using the air_alliances and air_routes collections, find which alliance has the most unique carriers(airlines) operating direct flights between the airports JFK and LHR , in both directions.

@PuneetC

I would strongly recommend that you post this to the “Report an issue” tab on the page, There is no one in this Forum who can make such a change, while the curriculum team who get the reported issues can.

As an exercise, you might also try to see exactly how you can define “non-direct” flights between the two specified airports with the data given.

Good luck.

Done using the “Report an issue” option