Fork me on GitHub

Hi there, I have a question...I have data in this shape:

({:product/code "42"
  :sku/code "1"
  :product/names [{:product/name "Camera"
                   :language/iso-639-1 "en"}
                  {:product/name "Appareil"
                   :language/iso-639-1 "fr"}]
  :product/type "Camcorders & Digital Cameras"}
and schema
(def schema {:product/code {:db/unique :db.unique/identity}
             :product/names {:db/valueType   :db.type/ref
                             :db/cardinality :db.cardinality/many
                             :db/isComponent true}
             :language/iso-639-1 {:db/valueType   :db.type/ref
                                  :db/isComponent true}})
Is it expected that I see these datoms?
[1 :product/code "42" 536870913 true]
[1 :product/names 2 536870913 true]
[1 :product/names 4 536870913 true]
[1 :product/type "Camcorders & Digital Cameras" 536870913 true]
[1 :sku/code "1" 536870913 true]
[2 :language/iso-639-1 3 536870913 true]
[2 :product/name "Camera" 536870913 true]
[4 :language/iso-639-1 5 536870913 true]
[4 :product/name "Appareil" 536870913 true]
If yes, why is it not showing me the language in:
(datascript/pull db ["*"] 3)
=> #:db{:id 3}


In the above the entity 3 should have attribute "en" but I never see it in the list of datoms


I am basically trying to have one datom per :language/iso-639-1 and refer to those from the product/name


Oh I see, if it's a ref I cannot really go back to the values - kind of makes sense


I wonder how I can model that now though


(as a note, I am letting datascript create the entities, no :db/add on my side)


uhm...I see I receive back some

(:tempids txs)
{"en" 3, "fr" 5, :db/current-tx 536870913}
still not clear ... digging digging


for my problem above, I am still trying to understand how to model, it feels like I need a composite key [:product/name :language] - is it something you usually do in datascript/datomic?