Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Datomic by

Currently there is no built in way to limit the results from a query. This puts the task on the user to limit the results by first querying for entity ids, limiting that number and then pulling the data.

1 Answer

0 votes
by

If you use the map-args of q (https://docs.datomic.com/client-api/datomic.client.api.html#var-q), you can both limit and offset the results:

(d/q '{:query '{:find [?id}
                :in [$]
                :where [[_ :ent/id ?id]]}
       :args [db]
       :limit 100
       :offset 35
       :timeout 60000})

limit - limit the number of results
offset - skip some results
timeout - milliseconds before giving up

If you looks at the top of https://docs.datomic.com/client-api/datomic.client.api.html then you can see them described. It took me sometime to work out how to pass them.

Welcome to the Datomic Knowledgebase, where you can make features requests, ask questions and receive answers from other members of the community.
...