Fork me on GitHub

Hi. Is it possible to get-database-names for datomic:mem://{host}:{port}/* URI? I.e. is is possible for *mem* DB's? Throws an error for me, asking about * in place of db name, but it's already there.


@andrewboltachev: works fine for me:

(d/get-database-names "datomic:mem://*")
("a" "b")


note that in process memory URI is just: datomic:mem://{db-name}


do datomic queries always return a set? or can i example, pull out a single value for an attribute?


Here for example, I'd like to avoid (first (first


but is the result of a query always a vector in a set? i don't mind having to pull things out, it just feels like im missing a trick


ffirst is useful


you can do [:find ?v . to get a single item


or [:find [?v] to get a seq


thanks dm3, that was the trick i was missing


is there a name for that ., documented somewhere?


important to note that :find ?a . will just return the first item, even if there are more results


@danielstockton: it’s worth mentioning that Datomic query doesn’t return a set of tuples by default just to be arbitrary. This behavior is the means by which you can compose queries. (It’s a similar story with SQL select and result tables/sets). That said, as others mentioned, for returning an (expected) single value or one collection, etc, that’s the exact use case that find specifications exist for.


Yep, understood. I actually tried implementing datalog on a toy project but didnt get into all the nitty gritty and special syntax


@currentoor: Not quite. sqUUIDs have leading bits making a timestamp with an accuracy of 1 second. Multiple d/squuids created within the same second will be randomly ordered. Also, clock on different peers may not be in sync, so the timestamps in the sqUUIDs generated on different peers may not reflect the order in which they were transacted.


@stuartsierra: Makes sense, thanks.


I have an id attribute on entities and this attribute is only set when the entity is created and it is never updated. If I want to sort a collection of entities by created-at times, I guess I can use the transaction time of that id attribute. Is this fine or is there a preferred way to do it?


@currentoor: that’s the approach I’d probably recommend (as long as you’re sure about the guarantee that it’s set at creation time and never changed), see answer here:


@bkamphaus: sounds good, Thanks!