Nikita Prokopov
Nikita Prokopov
thanks for reporting!
great! I’ll look into it
Objects are not serialized, but they are compared using CLJS compare https://github.com/tonsky/datascript/blob/eaa83844efda2e8d83e80521dd06a15a154c710b/src/datascript/db.cljc#L290. That means if you ever look up by value, you can only look up by primitives: strings, numbers,...
Here’s the code: https://github.com/clojure/clojurescript/blob/9ddd356d344aa1ebf9bd9443dd36a1911c92d32f/src/main/cljs/cljs/core.cljs#L2345-L2369 I guess maybe first case falls under `(identical? (type x) (type y))`? Not sure
> That must mean datascript must be doing a shallow or deep copy of the normal object that is being inserted. DataScript certainly does not do that. Check your tests
I’m sorry, you’re right. DS does tries to convert entities to CLJS values and back https://github.com/tonsky/datascript/blob/eaa83844efda2e8d83e80521dd06a15a154c710b/src/datascript/js.cljs#L36
usually it can store incomparable values. You can’t store them cardinality-many attributes, you can’t make them indexed or unique. Otherwise it should be fine.
Sorry I forgot about that issue. Yes it’s totally possible. Consider ```clj (js/JSON.stringify (into-array (for [d (d/datoms db :eavt)] #js [(:e d) (name (:a d)) (:v d)]))) ```