Subquery within same collection

collection schema

{ partId string
  partName string
  partDescription string
  sub-part {
                  partId string
                  version string
                 }
}

Data in the collection

{ “partId”: “123", “partName” : "laptop", “partDescription” : ”macBook" , sub-part : {124, "1.0"} , {“125", "2.1"}}
{ “partId”, "124", “partName” : "Keyboard", “partDescription” : “keyboard for gaming”}
{ “partId”: "125", “partName” : ”mouse”,”partDescription” :  "mouse for gaming"}
{ “partId”: “126”, “partName” : “desktop, “partDescription” : ”Dell”  , sub-part : {124, “2.0”} , {“125", “4.0”}}

I want to find all the part that have sub-parts and at the same time return part name and part description for sub-part.

Output

{ “partId”: “123", “partName” : "laptop", “partDescription” : ”macBook" , 
    sub-part : [ 
           { “partId”, "124", “partName” : "Keyboard", “partDescription” : “keyboard for gaming”, “version” :’1.0”},
           { “partId”: "125", “partName” : ”mouse”,”partDescription” :  "mouse for gaming”, “version” : “2.1”}
   ]
}
{ “partId”: “126”, “partName” : “desktop, “partDescription” : ”Dell”  ,
     sub-part : [
            { “partId”, "124", “partName” : "Keyboard", “partDescription” : “keyboard for gaming”, “version” :’2.0”},
            { “partId”: "125", “partName” : ”mouse”, ”partDescription” :  "mouse for gaming”, “version” : “4.0”}
    ]
}

Hello @tom_reed, welcome to the community.

You can use the $graphLookup aggregation stage to perform your query. See some of the examples in the provided documentation link.

Also, you may want to include a proper sample of the actual document (it is not clear the representation of the field sub-part in the posted sample).

EDIT ADD:

Here is an example I found with a similar question and some answers: