laravel-mongodb
laravel-mongodb copied to clipboard
Pagination does not accept string number
Summary
When calling the ->paginate() method with the first (perPage) argument, mongodb errors if the user passes in a string.
Steps to reproduce
- pass
per_page=20as a query parameter on an application running this library - use
->paginate($request->input('per_page'))in the called method - get a Mongodb error
the limit must be specified as a number
Fix
We should cast the $perPage argument to an integer before passing to mongodb; this works in the default Laravel drivers, and should work with this driver. This can be easily solved by a simple (int) cast