Chapter 3: $graphLookup: Simple Lookup Reverse Schema

Hi,

I am doing the video example with Compass and it works perfectly.

I copy the pipeline and run it in terminal, neither direct_reports nor all_reports appear. Any idea

Please share the output of:

db.parent_reference.find( { "name" : "Dev" } )

It is important for us to see the first document. Before posting read formatting code so that we can cut-n-paste whatever you publish.

As far as M121 is concerned, it looks like the collection parent_reference has no field name direct_reports, the field you specified as startWith. Perhaps the aggregation as to be run on child_reference directly. So that rather than:

db.parent_reference.aggregate( /* your pipeline */  )

it should be

db.child_reference.aggregate( /* your pipeline */  )

Thanks again @steevej , I used child_reference in Compass and parent_reference in the terminal.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.