How to Traverse Multi-level Classification

  mongodb, question

There is a table
list structure
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:

  • 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: