0

I have large data in mongoDB database, i want to execute in PHP and show on chart. but i get Fatal error: Allowed memory size
I even increased the memory of Ram by 2048. but i have error

My code:

        $dbconn = new MongoClient();
        $db = $dbconn->mydatabase;
        $myObj = $db->collection->find();

        $data = iterator_to_array($myObj);

        asort($data);

        if ($data) {

           $dataseries1 = array();

           $dataseries2 = array();

           foreach ($data as $dataset) {
               array_push( $categoryArray , array( "label" => $dataset["type"] ) );

               array_push( $dataseries1 , array( "value" => $dataset["id"] ) );  
           }

          $arrData["dataset"] = array(
            array("data" => $dataseries1),
            array("data" => $dataseries2)
          ); 

          $jsonEncodedData = json_encode($arrData);

          $msChart = new FusionCharts("msline", "demochart", "600", "400", "chart-container", "json", $jsonEncodedData);

          $msChart->render();
       }
Yaman Jain
  • 1,098
  • 10
  • 15
mona
  • 1
  • Possible duplicate of [PHP Allowed memory size](https://stackoverflow.com/questions/30812919/php-allowed-memory-size) – Squareoot Dec 26 '17 at 09:47
  • Please check this url i hope it's useful ... URL:-https://www.digitalocean.com/community/questions/how-to-increase-a-mongo-db-size – NimeSh Patel Dec 26 '17 at 10:05

0 Answers0