-
Notifications
You must be signed in to change notification settings - Fork 312
Closed
Description
This worked in 1.6.5:
(require '[datascript.core :as d])
(def schema {:item/tags {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}})
(def conn (d/create-conn schema))
(d/transact! conn [{:db/id "1"
:item/tags #{{:tag/name "foo"}
{:tag/name "bar"}}}])In 1.7.1, it throws an error, "Expected number or lookup ref for entity id, got nil".
I tracked it to the new function, assoc-auto-tempids, which only assigns tempids to inline maps of a many ref value if the value is sequential?, which sets are not. So now one must use a sequential value, such as:
(d/transact! conn [{:db/id "1"
;; Vector, not set.
:item/tags [{:tag/name "foo"}
{:tag/name "bar"}]}])But I think it's logical to be able to transact many ref entities inline as a set of maps, since that's also how they are returned when queried.
Is this as simple as changing This line to check coll? rather than sequential??
Metadata
Metadata
Assignees
Labels
No labels