[SERVER-47069] $graphLookup output should provide $$depth expression to get depth in output Created: 24/Mar/20  Updated: 27/Oct/23  Resolved: 24/Mar/20

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Hitesh Baldaniya Assignee: Katya Kamenieva
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-26029 $graphLookup should provide "path" in... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Can we get the depth of the evaluation as well along with output documents?

db.employees.aggregate( [ { $graphLookup: { from: "employees", startWith: "$reportsTo", connectFromField: "reportsTo", connectToField: "name", as: "reportingHierarchy" } } ] )

"reportingHierarchy" => should provide output like {depth: 1, documents: [{}, {}]}

It will help us to reduce no. of queries in order to find depth of children.



 Comments   
Comment by Katya Kamenieva [ 24/Mar/20 ]

hitesh.baldaniya@contentstack.com, what you are describing looks like an existing `depthField` field https://docs.mongodb.com/manual/reference/operator/aggregation/graphLookup/index.html

Comment by Carl Champain (Inactive) [ 24/Mar/20 ]

Hi hitesh.baldaniya@contentstack.com,

Thank you for the report.
We are passing this ticket along to the appropriate team for further investigation. Updates will be posted on this ticket as they happen.

Kind regards,
Carl
 

Generated at Thu Feb 08 05:13:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.