Mongo Playground

Configuration

[{_id:123,name:"Folder1",parentID:null},{_id:412,name:"ABC.txt",data:"Binary(...)",parentID:123},{_id:512,name:"CDF.txt",data:"Binary(...)",parentID:123},{_id:125,name:"Folder2",parentID:null},]

Query

db.collection.aggregate([{$match:{name:"Folder1"}},{$lookup:{from:"collection",localField:"_id",foreignField:"parentID",as:"children"}},{$project:{children:{$concatArrays:["$children",[{_id:"$_id",name:"$name",parentID:"$parentID"}]]}}},{$unwind:"$children"},{$replaceRoot:{newRoot:"$children"}}])

Result