datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Aleh Atsman 2021-06-28T12:38:34.321100Z

Hey, what's the best way to construct query that returns all items with specified ids. Given I have list of ids, let's say list of user/id, how do I get all entities corresponding to these ids?

1🤯1🙏1🆘
RollACaster 2021-06-28T13:43:34.321500Z

I’m not sure if it’s the best way to go since I’m new to Datomic, but that’s how I would do it:

(d/q
 '[:find ?e
   :in $ [?id ...]
   :where
   [?e :user/id ?id]]
 db
 ["id-1" "id-2"])

1❤️
Aleh Atsman 2021-06-28T15:26:17.321700Z

@thsojka thanks! that's exactly what I was looking for!