Is there a way to specify order for an fkey field in an include expression?

#1

Assume MyType.scores is an fkey field

I know I can filter on fkey fields like this:

MyType.fetch({include: "scores.(value > 0)"});

but can I specify an order? I imagine it would work like this:

MyType.fetch({include: "scores.({order: 'descending(value)'})"});

I am aware of the @db annotation for fkey fields, but as far as I know only one order can be set at a time, and it must be set at provision time—I am looking for a way to specify order at runtime.

0 Likes

#2

This is not supported at this time. Ordering on fkey fields is only supported statically in the fkey field definition.

0 Likes