Question regarding $graphLookup

Hi guys, I find $graphLookup to be quite confusing comparing to $lookup, here are some question I don’t really understand

  • is it that, the fields for connectFromField and connectToField, has to be from the same collection?(comparing to $lookup, which uses 1 field from each collection)
  • is startWith like the “foreignField” for $graphLookup? the only place that can specify the value for other collection
  • also, the final Lab for chapter3 graphLookup(M121),
db.air_alliances.aggregate([
				{$graphLookup: {
    						from: "air_airlines",
    						startWith: "$airlines",
    						connectFromField: "name",
    						connectToField: "name",
    						as: "test"
    							}
    			}
])

connect from “name” to “name”, so no connection, basicly search elements from $airlines array in the “name” field, right?

Please ignore the questions above.

  • so startWith is where I can specify the expression for local field right? what I mean was, I cant use field path expression from the “from” collection in startWith right?(only “local field”)
  • connectFromField and connectToField can only have field name from the collection specified in “from”(the foreign collection), and only field name in “foreign collection” right?