Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being able to order by calculated values #707

Closed
AzariasB opened this issue Aug 5, 2020 · 2 comments
Closed

Being able to order by calculated values #707

AzariasB opened this issue Aug 5, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@AzariasB
Copy link
Contributor

AzariasB commented Aug 5, 2020

Is your feature request related to a problem? Please describe.
I'm using postgresql and would like to be able to execute an order by like this : order by length(my_column)

Describe the solution you'd like
Either being able to use the orderBy provided by mikro-orm : myquery.orderBy({'length(my_column)':'asc'})
or adding a new method to have the same thing as knex : myquery.orderByRaw({'length(my_column)':'asc'})

Describe alternatives you've considered
I could load all the entities and then do the sorting in typescript

Additional context
Currently, when doing order by length(my_column) I get the error : column.split is not a function
I'm using postgreql 12.3 and mikro-orm 4.0.0-alpha.9

@AzariasB AzariasB added the enhancement New feature or request label Aug 5, 2020
@B4nan B4nan added this to the 4.0 milestone Aug 10, 2020
@B4nan B4nan self-assigned this Aug 10, 2020
@B4nan B4nan closed this as completed in e4674c7 Aug 10, 2020
@B4nan
Copy link
Member

B4nan commented Aug 10, 2020

qb.orderBy({ 'length(my_column)': 'asc' }) will be supported in 4.0.0-rc.1

@AzariasB
Copy link
Contributor Author

Wow, awesome, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants