0

I'm trying to list all the documents I have inside a MongoDB collection, but I keep receiving this error:

MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 1000000000 in (...):16 Stack trace: #0 {main}

I think that I'm receiving this error because the following value is too big to be an integer.

My code:

try {

        $mongo = new MongoDB\Driver\Manager('...');

        $query = new MongoDB\Driver\Query([]);

        $rows = $mongo->executeQuery('..', $query);    

        echo json_encode(iterator_to_array($rows));


    } catch (MongoDB\Driver\Exception\Exception $e) {


      echo $e;
}

How can I solve this issue?

Thank you.

Rúben Dias
  • 45
  • 1
  • 9

2 Answers2

0

actually you trying to get all the content which is consuming large amount of memory you should make a chunks. see this one

mk Mughal
  • 286
  • 4
  • 16
0

If you working with 64-bit int then your PHP also should be 64-bit (-;

Neodan
  • 5,154
  • 2
  • 27
  • 38