Fork me on GitHub
#datomic
<
2022-02-17
>
Andrej Golcov13:02:51

Hi, We have parent-child relations in datomic, something like:

{
 :rootId "1"
 :child/ids [{:childType "a" :childId "2"} {:childType "b" :childId "3"}]
 }
If I want to pull parent data with related children entities, the pull expression looks like this:
[:rootId {:child/ids [:childType :childId]}]
Q: Is there is any way to make pull to retrieve specific child entities e.g. only with type="a"? Something similar to json-path: $child/ids[?(@.type="a")].childId thanks.

kipz14:02:45

I don't think there is. I'd normally change the query to return multiple entities and pull specific attributes off each one.

thumbnail16:02:21

I've looked into this in the past as well and couldn't find a way.