Database
db={"fileSystem":[{"_id":"a","label":"Root","children":["b",],},{"_id":"b","label":"Nested folder 1","children":["c","d","e"],"parent":"a"},{"_id":"c","label":"Nested File 1.1","parent":"b"},{"_id":"d","label":"Nested File 1.2","parent":"b"},]}
Query
db.fileSystem.aggregate([{"$match":{"_id":"a"}},{"$graphLookup":{"from":"fileSystem","startWith":"$children","connectFromField":"children","connectToField":"_id","as":"nest","depthField":"level","maxDepth":1}},])