datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
2018-09-03T13:11:44.000100Z

is it possible to keep the order of cardinality/many data?

2018-09-03T13:11:47.000200Z

2018-09-03T13:12:34.000100Z

I would prefer that the returned :tags be left in their original order

2018-09-03T13:12:52.000100Z

thanks!

mattly 2018-09-03T15:19:17.000100Z

You need to store that separately

mattly 2018-09-03T15:19:36.000200Z

Either on some kind of “join” entity with an order value

mattly 2018-09-03T15:20:13.000100Z

Or an ordered collection value on the tagged object that is not the relation

mattly 2018-09-03T15:20:28.000100Z

They both have pros and cons

mattly 2018-09-03T15:20:39.000100Z

Personally I’ve found it easier to do the latter

petterik 2018-09-03T16:47:45.000100Z

@dimovich There's a section about this on the Tips & tricks page: https://github.com/tonsky/datascript/wiki/Tips-&-tricks#preserving-order

2018-09-03T19:07:48.000100Z

@mattly @petterik thanks for the tips!

✌️ 2