title: MongoDB: $graphLookup in reverse order
body: <p>I have the following dataset:</p>
  
  <pre><code>{
    _id: ObjectId("asdasdasd..."),
    dependencies: {
      customers: [
        ObjectId("1..."),
        ObjectId("2...")
      ]
    }
  }
  </code></pre>
  
  <p>I use "$graphLookup" to see all customers, that have a relation to each other.</p>
  
  <pre><code>db.getCollection('customers').aggregate([{
    $graphLookup: {
      from: "customers",
      startWith: "$dependencies.customers",
      connectFromField: "dependencies.customers",
      connectToField: "_id",
      depthField: "depth",
      as: "dependencies.customers",
      maxDepth: 5,
    }
  }])
  </code></pre>
  
  <p>This works all fine. But now i want to look up the graph in reverse order. The last customer in the dependency tree have no other dependencies to other customers. Of cource, otherwise i wouldnt be the last customer in that tree.</p>
  
  <p>Is it somehow possible to see all customers that have a dependency to the last customer in the tree?</p>
  
  <p>e.g.
  normal GraphLookup:
  C1 => C2 => C3 => ...</p>
  
  <p>reverse GraphLookup:
  C3 => C2 => C1</p>
  
  <p>Maybe i need to change the schema... but i dont know how.</p>
  
  <p>Another option would be to store 2 different types of dependencies: parent, children. But this makes it necessary to do all changes twice: for the customer that have a dependency X in parent and for the customer that have dependency X in children.</p>
  
  <p>Any ideas?</p>