VikasR
VikasR

Reputation: 11

not able to create an entity with db.type/tuple in datomic

Datomic newbie here. Playing with various valueTypes and can't get tuple data type to work.

Here's how defined the schema:

(d/transact conn {
             :tx-data [{
                :db/ident       :df/Errors 
                :db/valueType   :db.type/tuple 
                :db/tupleType   :db.type/string 
                :db/cardinality :db.cardinality/many}]})

This worked. However, I can't figure out how to enter sample data. I tried

(d/transact conn {:tx-data [{
                :df/Errors ["Error-code" "sample error message"]}]})

But it gives an error:

Invalid tuple value

As per docs, the tuple value is a vector with 2 to 8 elements. So, not sure what I'm doing wrong. Please help.

Upvotes: 0

Views: 75

Answers (1)

Marcellinus
Marcellinus

Reputation: 132

Since the cardinality is many, the sample data code should look like this:

 (d/transact conn {:tx-data [{:df/Errors [["Error-code" "sample error message"]]}]})

Upvotes: 0

Related Questions