Fork me on GitHub
#xtdb
<
2019-10-21
>
Daniel Mason14:10:13

I suppose in a sense you can get both a date-created and date-updated by using the history api and taking the tx-time from the last result in the entity's history for date-created value and the tx-time from the first result in the history for date-updated

Daniel Mason14:10:42

Not stored within an entity itself, though, unsure if that could be used to sort within a crux query.

benzap15:10:38

The documentation seems to say that this isn't possible, but i'll do some fishing around

benzap15:10:44

Would you happen to know about a good resource listing all of the supported query functions that can be used, or should I follow the datomic documentation and negate any functions they deem unsupported in the crux documentation?

Daniel Mason15:10:04

I think the best resource for this would likely be the crux queries page in the documentation, https://juxt.pro/crux/docs/queries.html

Daniel Mason15:10:14

I believe at the moment the best way to do this would to just use sort-by, like this (or something similar, anyway) for sorting by creation time

(sort-by #(:crux.tx/tx-time (last (crux/history node %)) entities)

benzap15:10:17

I've read that over, but there doesn't seem to be an API reference for what can be used within a query. I understand that crux is still early alpha, so I expect these things to be left out until things have settled down into a stable version

benzap15:10:26

See, the problem with that is I don't want to pull all of my entities into memory. In situations where i'm using pagination, that query is not optimal

Daniel Mason15:10:37

Definitely something worth adding to the docs, for sure.

👍 4
benzap15:10:59

I was hoping that they might have something akin to {:order-by [(first-tx-time) :asc]} or something similar, so I could include the :limit and :offset for pagination