-
Notifications
You must be signed in to change notification settings - Fork 152
Description
To order by multiple columns, you currently make multiple orderBy calls. As per https://tanstack.com/db/latest/docs/live-queries#multiple-column-ordering
const sortedUsers = createLiveQueryCollection((q) =>
q
.from({ user: usersCollection })
.orderBy(({ user }) => user.departmentId, 'asc')
.orderBy(({ user }) => user.name, 'asc')
)However, in the intro https://tanstack.com/db/latest/docs/live-queries#tanstack-db-live-queries the blurb says:
The query builder doesn't perform operations in the order of method calls - instead, it composes your query into an optimal incremental pipeline that gets compiled and executed efficiently
I assume that in the case of orderBy calls, the order of the function call is preserved and used by the query builder. However this jumped out as a possible source of confusion / inconsistency.
Could we consider (a) orderBy supporting an array of OrderByOptions? Or (b) perhaps an explicit note in the docs (maybe "except for orderBy" in the preamble blurb and an info/note in the orderBy section to state that order matters for orderBy method calls?