You can use datomic.api/datoms fn to access objects in a lazy way.
Please note that you need to specify the type of index when calling datoms , and the types of indexes available to you depend on the type of attribute you are interested in. For example, the :avet index is only available if your attribute has :db/index set in the schema, and the :vaet is only available if your attribute is of the type :db.type/ref .
We use something similar at work (note: for this there must be a ref-attr attribute ref-attr ):
(defn datoms-by-ref-value "Returns a lazy seq of all the datoms in the database matching the given reference attribute value." [db ref-attr value] (d/datoms db :vaet value ref-attr))
The datoms documentation datoms bit sparse, but with some trial error, you can probably decide what you need. There's a post from August Lilleaas about using an index :avet (which requires an index for an attribute in a datomic schema), which I found somewhat useful.
source share