This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-29
Channels
- # beginners (16)
- # cider (7)
- # clj-kondo (4)
- # clj-together (1)
- # cljsrn (1)
- # clojure (11)
- # clojure-europe (4)
- # clojure-norway (6)
- # clojure-spec (1)
- # clojurescript (2)
- # datalevin (35)
- # datomic (9)
- # honeysql (1)
- # introduce-yourself (3)
- # lsp (6)
- # off-topic (25)
- # pathom (1)
- # polylith (1)
- # releases (1)
- # shadow-cljs (38)
- # sql (5)
i have a basic question. based on the example on this doc, https://docs.datomic.com/peer-tutorial/query-the-data.html,
(d/q all-movies-q db)
#{[17592186045420] [17592186045421] [17592186045422]}
entity ids seem to be integers, which are sequential.
i wonder why datomic uses sequential data rather than uuid. wouldn't it expose to some security risks?
or is it customary to add a user-defined id (e.g. in uuid) to the schema?Since you do not control entity ids you should treat them as an implementation detail and not use them outside your system. So, yes, adding additional identifiers for any content you need address externally is a good idea.
also, you should not expose :db/id
's in you API
it is ok-ish to use. But once you don't control it, it is not a good idea. For example, db/id's may change after a backup restore process.
> For example, db/id's may change after a backup restore process. Really? Is that documented somewhere?
Favila wrote about entity IDs here btw: https://favila.github.io/2024-05-16/datomic-entity-id-structure/
for all entities that are expose to the outside (in api's, url's etc), i used to set up a unique external id property (:external/id) and use that.