Fork me on GitHub
#datascript
<
2017-11-07
>
jjttjj21:11:29

if i have a deeply nested data schema, such as this:

[{:type      :continent
  :countries [{:type   :country
               :name   "usa"
               :states [{:type   :city
                         :name   "seattle"
                         :people [{:name "fred"}
                                  ...]}
                        ...]}
              ...]}
 {:type      :continent
  :name      "asia"
  :countries [{:type   :country
               :name   "japan"
               :states [{:type   :city
                         :people [{:name "fred"}
                                  {:name "frank"}
                                  ...]}
                        ...]}
              ...]}]
:names are unique per continent and per type. If I have the :db/id of a continent and want to get the descendent entity with :name "fred" below it, what's the best way to go about doing that in as general a way as possible? Is it possible to do this without "hardcoding" the tree structure I will also be needing to query for names of countries, cities, etc for a given continent. Is there a way to "nest" queries, where i can query for the entities of a certain continent, and then query those results?