Lab: Lookup:air_routes

I understand that aggregation will start with the air_alliances, and then I need a join with the routes for each airline in the alliance.
I can start with a lookup to “air_airlines” to fetch the airline record based on the name in the example lesson. I am thinking that I do another lookup on the resultset with localfield as airlines but now it is an object array of airlines records, instead of names. And joining collection will be air_routes. I am not sure what can be localfield, can it be object array [airlines] and and the foreign field can be “” and as can airline_routes. But route array is null. I am also not understanding which field represents the airplane name like “747” or “380” ?
“from”: “air_routes”,
“localField”: “airlines”,
“foreignField”: “”,
“as”: “airlines_routes”

The field airplane represents the airplane.

Really appreciated Steve, I didn’t notice the airplane as it was way down in route document.

I was wondering if you should start from air_routes, and strip out all routes that don’t have a 747 or 380 in it.

Use regex with the | (the OR), that way your document set is smaller.

Liking regex more and more, it just saved me writing $or .

1 Like


I agree with @NMullins, I would follow his suggestions.

José Carlos

1 Like