How to Traverse Multi-level Classification

  mongodb, question

There is a table
list structure
Id,name,description,parent_id
There are multiple sub-classifications under one classification, and there will be sub-classifications under each sub-classification, with a depth of about 10 layers.
The arrangement of classifications is also irregular, and the desired results are as follows:
Fruits

  • Domestic fruit
    • Northern region
      • Liaoning province
      • Shandong
        ….
    • Southern region
      • Hunan
        ….
  • Imported fruit
    ….
  • Boutique gift box
    ….

It is better not to use recursion in this infinite classification.

There is a more efficient scheme (left value and right value scheme) for the classification information with little change in the tree type itself:
http://ftp.nchu.edu.tw/MySQL/tech-resources/articles/hierarchical-data.html