another issue troubling me with fleetdb is the requirement for an :id.
I have a lot of collections where each row is per definition unique.
However there is no special :id coming from the data itself. Now, I'm
in trouble to invent such a field. Couldn't fleetdb generate such a
field with the desired properties (ie. being unique)? It think couchdb
does that. If there is no :id, make one. Otherwise use it.
Or is there another preferred way? Some UUID library or so?
Sincerely
Meikel
If you need to generate a UUID, you can use java.util.UUID:
(defn- uuid []
(str (UUID/randomUUID)))
You might also consider integer ids, because they are much more
efficient that strings (e.g. UUIDs). If you have a modest number of
records, the following will suffice:
(defn rand-id [#^Random rand]
(Math/abs (.nextLong rand)))
If you'de like to see auto-id functionality in the Clojure client
library I would consider a patch.
HTH,
- Mark