laravel-mongodb
laravel-mongodb copied to clipboard
[Question] orderBy() with natural sorting
Hi! First of all thank you very much for this library! It's really useful and convenient! I cannot understand one thing: how should i use orderBy(). So my query is here:
return (new Elements())
->newQuery()
->where('user_id', $user_id)
->where('child', false)
->where('in_trash', false)
->orderBy('title')
->paginate(10);
The result of this query is:
12312123 AZaz WQER ZXC az test zxc
As you can see the sorting is not 'natural'.
I need to make the query that would return this items with this order:
12312123 AZaz az test WQER ZXC zxc
I studied in detail this issue https://github.com/jenssegers/laravel-mongodb/issues/148 But anything i have tried didn't help me.
I would be really appreciated if you tell me how can could i make the needed sorting.