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.

Hi @VikasR

What version of Datomic are you using? What kind of tuple are you making? It looks like you want a heterogeneus tuple. Composed of two strings elements.

If that is true then you have a typo in :db/tupleType it should be :db/tupleTypes and include a vector of component types for a heterogeneus tuple of string, string. So something like this:

{:db/ident :df/errors
 :db/valueType :db.type/tuple
 :db/tupleTypes [:db.type/string :db.type/string]
 :db/cardinality :db.cardinality/many}

Hope this helps! I don’t know if you have done this yet or not, but I’d encourage you to check out the examples and docs on tuples here: Schema | Datomic