Skip to content

Pagination does not accept string number #1750

Open
@phroggyy

Description

@phroggyy

Summary

When calling the ->paginate() method with the first (perPage) argument, mongodb errors if the user passes in a string.

Steps to reproduce

  1. pass per_page=20 as a query parameter on an application running this library
  2. use ->paginate($request->input('per_page')) in the called method
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs investigationNeed investigation about bugs described in issuebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions