Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-42270

$graphLookup should have a way to stop evaluation when certain criteria is met

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None

      Currently when using $graphLookup there is no easy way to make the evaluation stop as soon as certain criteria is met. For example, if I want to find the shortest path from A to B, I can't use $graphLookup efficiently, since it wouldn't stop evaluation as soon as B is found. It continues until no more matching documents are found, or until the operation reaches a recursion depth specified by the maxDepth parameter.

      Maybe we we add some field like `limit : <integer>` this can be solved. For the above case user can specify `limit: 1` so that we can stop evaluation as soon as we find the first object.

            Assignee:
            asya.kamsky@mongodb.com Asya Kamsky
            Reporter:
            arun.banala@mongodb.com Arun Banala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: