Fork me on GitHub
#datascript
<
2020-04-12
>
hindol17:04:07

Hi, I just started playing around with DataScript today, so a complete beginner. Is this the correct way to pull everything from a db? Can I skip the :where clause entirely?

(d/q '[:find (pull ?e [*])
       :where
       [?e]]
     @ds)

metasoarous17:04:05

That will work, but may pull duplicate records for nested component entities

metasoarous17:04:50

Note that you cannot do that in Datomic however; It prevents you from executing certain queries that have the potential to request the entire db.

hindol17:04:50

Okay, not that I need the specific query. Just getting the hang of it. How would you pull all entities from a db?

hindol18:04:16

Is it possible to insert an arbitrary object into DataScript DB? I am sometimes getting an exception that the object is not comparable. Looks like DS tries to insert the object into a sorted set.