Lab-$graphLookup understanding 2nd stage of $graphLookup

I don’t understand how this works can someone help me?

  1. startWith is from “$airlines.base” this field’s value is something like “KTE”, “BRN”, “LVI”
  2. connectionFromField why is it “dst_airport”? why can’t “src_airport” and vice-versa

Noticed that the destination and source airport type value is $airlines.base

{
    $graphLookup: {
      startWith: "$airlines.base",
      from: "air_routes",
      connectFromField: "dst_airport",
      connectToField: "src_airport",
      as: "connections",
      maxDepth: 1
    }
  }

Hi @Rakshith_79674,

I believe the following documentation link would be helpful to understand the fields in the $graphlookup stage:

Please feel free to reach out if the issue still persists for you.

Kind Regards,
Sonali Mamgain

1 Like