laravel-mongodb
laravel-mongodb copied to clipboard
orderBy doesn't work
- Laravel-mongodb Version: 3.8.4
- Laravel Version: v8.50.0
- PHP Version: 8.0.8
- Database Driver & Version: mongodb/mongodb 1.9.0
Description:
orderby doesn't work
Steps to reproduce
- $query = Model::where('blah', 'blah')->orderBy('age', 'desc');
Expected behaviour
should return a query
Actual behaviour
an exception is raised ErrorException Undefined array key "column"
Logs:
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php:740nevermind, looks like there was some issue on my code. I swear I've been testing it for a lot but it seems it was my fault
It's working, i think you need to check your name of columns. Then you should to add "->get()" end of query. If you don't add "->get()" it returns "Jenssegers\Mongodb\Eloquent\Builder".
But this does not work for yajra datatables with mongo db ....on adding order by it returns Trying to access array offset on value of type int on doing order by