What is the more efficient way to store tree with seven level ? (taxonomy ranks)

Hi everyone,

I want to store a quite large amount of data which is a simple tree. I’m a beginner with Realm and MongoDB.

I saw the doc here : https://www.mongodb.com/docs/manual/applications/data-models-tree-structures/

But I’m using the flutter / dart lib and I prefer to have one specific class by rank or something else to identify the type of object easily.

Is multiple OneToMany relation to perform query bottom up will be efficient like below ? I like this approach because the query will be verbose and without redundancy. But is this approach not to “relational” and then not efficient on read ?

@RealmModel()
class $Kingdom {
  @PrimaryKey()
  @MapTo('_id')
  late String id;
  late Map<String, String> names;
  @Backlink(#kingdom)
  late Iterable<$Phylum> phylums;
}

@RealmModel()
class $Phylum {
  @PrimaryKey()
  @MapTo('_id')
  late String id;
  late Map<String, String> names;
  late $Kingdom? kingdom;
  @Backlink(#phylum)
  late Iterable<$Class> classes;
}

@RealmModel()
class $Class {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $Phylum? phylum;
  @Backlink(#classification)
  late Iterable<$Order> orders;
}

@RealmModel()
class $Order {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $Class? classification;
  @Backlink(#order)
  late Iterable<$Family> families;
}

@RealmModel()
class $Family {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $Order? order;
  @Backlink(#family)
  late Iterable<$SubFamily> subFamilies;
}

@RealmModel()
class $SubFamily {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $Family? family;
  @Backlink(#subFamily)
  late Iterable<$Tribe> tribes;
}

@RealmModel()
class $Tribe {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $SubFamily? subFamily;
  @Backlink(#tribe)
  late Iterable<$Species> species;
}

@RealmModel()
class $Species {
  @PrimaryKey()
  @MapTo('_id')
  String? id;
  late Map<String, String> names;
  late $Tribe? tribe;
}

Thanks in advance!