I use laravel-mongodb by jenssegers. I want to query a huge amount of data with order by and this is my query :
$stores = \App\StoreTransaction::where('date_time','>',1489944515)
->orderBy('date_time', 'asc')->get();
But I got this error:
Sort exceeded memory limit of 104857600 bytes
I know I should add allowDiskUse true to my query but how can i add it to mongodb jenssegers package ?
date_time$stores = \App\StoreTransaction::where('date_time','>',1489944515) ->orderBy('date_time', 'asc')->paginate(100)to get 100 records per time into memory. I'm not sure but I hope that this is implemented lazily. Otherwise, you want to do this using the cursor from a raw database command