JsonB sorting within Resource.actions
I have a Resource with a jsonb column called
metadata
How do I default sort by `metadata ->> 'CreatedDate'?
5 Replies
metadata[“CreatedTime”]
How do you do in descending order with that?
oh, sorry, was tired when I read this
You can't actually sort on expression right now
what you'd do is add a calculation and sort on that
Then you'd say
build(sort: [created_time: :desc])
thank you! works perfect!
Somehow the generated Sql ended up double casting
See the double
::timestamp::timestamp
at the backYeah, that happens sometimes TBH
its something we can fix
but isn't a high priority
since it doesn't really affect anything
well, it affects query readability
but not correctness