Fork me on GitHub
#xtdb
<
2022-08-14
>
walterl12:08:23

Hi there. šŸ‘‹ I just went through the fun https://nextjournal.com/xtdb-tutorial last night, and now I'm quite excited to start using XTDB. xt Where can I report 2 minor corrections?

walterl20:08:26

I'll just leave this here: ā€¢ Lesson 5 ("match"): s/sees the 1000 credits move from/sees the 100 credits move from/ ā€¢ Lesson 7 ("evict"): There's a reference to history-descending, which I assume was changed to entity-history as used in the example code.

Steven Deobald09:08:20

@UJY23QLS1 The tutorial is open source. Feel free to add issues: https://github.com/xtdb/xtdb-tutorial/issues ... thanks!

walterl13:08:18

Thanks @U01AVNG2XNF, @U899JBRPF. I couldn't spot a link to where the source might be. Here's a PR for you šŸ™‚ https://github.com/xtdb/xtdb-tutorial/pull/21

šŸŒž 1
šŸ™ 1
walterl17:08:22

Is it possible to :order-by attributes that don't exist for some records, without excluding those records?

Jacob O'Bryant19:08:18

There isn't any documentation for it that I'm aware of, but you can use get-attr for this. E.g. see this example from the tests: https://github.com/xtdb/xtdb/blob/e2f51ed99fc2716faa8ad254c0b18166c937b134/test/test/xtdb/query_test.clj#L1096 you could add a :order-by [[age :desc]] to that example to sort by age, and any documents without an age will get a default age of 0

ā¤ļø 1
walterl19:08:13

w00t! That's exactly what I was looking for, thanks @U7YNGKDHA šŸ™Œ

šŸŽ‰ 1
šŸ‘Œ 1
šŸ™ 1
walterl17:08:11

'{:find [(pull e [* [:sort-order {:default 999}]])]
  :where [[e :xt/id]]
  :order-by [[:sort-order :asc]]}
I've tried that ā˜ļø, but > "Order by requires an element from :find."

walterl17:08:14

OTOH if I add [e :sort-order order] to the :where clause, it filters out docs with no :sort-order set