{"id":15572,"date":"2017-01-06T16:27:37","date_gmt":"2017-01-06T10:57:37","guid":{"rendered":"http:\/\/www.fusioncharts.com\/blog\/?p=15572"},"modified":"2026-01-20T14:40:55","modified_gmt":"2026-01-20T09:10:55","slug":"create-charts-using-php-mongodb","status":"publish","type":"post","link":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/","title":{"rendered":"Create Charts Using PHP and MongoDB: 2026 Stack Tips"},"content":{"rendered":"PHP is one of the most widely used server side languages. We\u2019ve already got <a href=\"https:\/\/www.fusioncharts.com\/php-charts\/\" target=\"_blank\" rel=\"noopener noreferrer\">detailed documentation<\/a> on how PHP can be easily integrated with FusionCharts using the FusionCharts-PHP wrapper. We also had a recent blog post on how you can use the <a href=\"https:\/\/www.fusioncharts.com\/blog\/2017\/01\/creating-charts-with-zend-and-fusioncharts\/\" target=\"_blank\" rel=\"noopener noreferrer\">Zend Framework (a cluster of PHP packages) with FusionCharts<\/a>.\r\n\r\nPHP is fairly easy to work with, w.r.t its support for many database technologies. However, there is some work involved when using PHP with a NoSQL database.\r\n\r\nHowever, before we move to talking about that, it is important that we brush up on what is NoSQL, for there will be many of us who aren\u2019t familiar with this database technology.\r\n\r\nLet\u2019s first talk about:\r\n\r\n<ul>\r\n<li>What is NoSQL?<\/li>\r\n<li>Why people use NoSQL?<\/li>\r\n<\/ul>\r\n\r\nHere goes the answers\u2026\r\n\r\n<b>NoSQL<\/b> also referred to as \u2018NOT ONLY SQL\u2019 or \u2018non relational\u2019 database, provides a data storage and retrieval mechanism that is modeled differently from the traditional tabular relations that are used in relational databases.  NoSQL is used because it encompasses a wide variety of different database technologies that were developed in response to the demands presented in building modern applications. Top NoSQL databases used today include MongoDB, Redis, Cassandra, CouchDB HBase, Neo4j, and so on.\r\n\r\nIn this blog post, we\u2019ll explore how to integrate PHP with MongoDB and create a chart using FusionCharts. MongoDB is an open-source, document-oriented database developed by MongoDB Inc. It works on the concept of document and collections, stores data in the JSON format, and can vary in structure as per the requirement. Query access is fast through the MongoDB Query Language. It uses dynamic schemas, meaning that you can create records without first defining the structure, such as the fields or the type of values.\r\n\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_71 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#Now_that_we_have_the_basics_sufficiently_covered_lets_get_started%E2%80%A6\" title=\"Now that we have the basics sufficiently covered, let\u2019s get started&#8230;\">Now that we have the basics sufficiently covered, let\u2019s get started&#8230;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#Next_we_move_on_to_how_you_can_create_the_database\" title=\"Next, we move on to how you can create the database\">Next, we move on to how you can create the database<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#STEP_I_Configuration\" title=\"STEP I (Configuration)\">STEP I (Configuration)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#STEP_II\" title=\"STEP II\">STEP II<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#STEP_III_Main_Page\" title=\"STEP III (Main Page)\">STEP III (Main Page)<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Now_that_we_have_the_basics_sufficiently_covered_lets_get_started%E2%80%A6\"><\/span>Now that we have the basics sufficiently covered, let\u2019s get started&#8230;<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\nTo get the code in this blog working, we need to install the following components:\r\n\r\n<ul>\r\n<li>XAMPP [<a href=\"https:\/\/www.apachefriends.org\/download.html\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>]\r\n<b>Note:<\/b> For v3.2.2<\/li>\r\n<li>MongoDB [<a href=\"https:\/\/www.mongodb.com\/download-center?jmp=nav#community\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>] [<a href=\"https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-windows\/\" target=\"_blank\" rel=\"noopener noreferrer\">Setup<\/a>]\r\n<b>Note:<\/b> For v.3.2.10<\/li>\r\n<li>PHP driver for MongoDB [Download Link]\r\n<b>Note:<\/b> For v5.6.23<\/li>\r\n<li>FusionCharts Suite XT [<a href=\"https:\/\/www.fusioncharts.com\/download\/\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>]<\/li>\r\n<li>FusionCharts PHP Wrapper [<a href=\"https:\/\/www.fusioncharts.com\/php-charts\/\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>]<\/li>\r\n<li>Composer [<a href=\"https:\/\/getcomposer.org\/download\/\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>]<\/li><\/ul>\r\n\r\nMake sure that all the above mentioned components are present in the system and are working as expected.\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"Next_we_move_on_to_how_you_can_create_the_database\"><\/span>Next, we move on to how you can create the database<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n<b>Step 1:<\/b> Execute the command \u201c<b>mongod<\/b>\u201d using the shell to run the mongodb server.\r\n\r\n\r\n\r\n<b>Step 2:<\/b> Create a json file that contains the data that goes into the database and will used as the source data for the chart. We\u2019ll name this file as <b>fuel_price.json<\/b>.\r\n\r\n<pre class=\"lang:javascript\">[\r\n  {\r\n    \"month\": \"Jan\", \"petrol\" : 64.72, \"diesel\": 52.49\r\n  },\r\n  {\r\n    \"month\": \"Feb\", \"petrol\" : 62.81, \"diesel\": 50.72\r\n  },\r\n  {\r\n    \"month\": \"Mar\", \"petrol\" : 66.18, \"diesel\": 54.06\r\n  },\r\n  {\r\n    \"month\": \"Apr\", \"petrol\" : 65.17, \"diesel\": 51.74\r\n  },\r\n  {\r\n    \"month\": \"May\", \"petrol\" : 72.94, \"diesel\": 57.23\r\n  },\r\n  {\r\n    \"month\": \"Jun\", \"petrol\" : 73.77, \"diesel\": 55.83\r\n  },\r\n  {\r\n    \"month\": \"Jul\", \"petrol\" : 70.7, \"diesel\": 52.59\r\n  },\r\n  {\r\n    \"month\": \"Aug\", \"petrol\" : 66.72, \"diesel\": 47.54\r\n  },\r\n  {\r\n    \"month\": \"Sept\", \"petrol\" : 64.61, \"diesel\": 47.02\r\n  }\r\n]<\/pre>\r\n\r\n<b>Step 3:<\/b> Import the <b>.json<\/b> file created in Step 2 into mongodb using the command shown below.\r\n\r\n<h5>mongoimport -d database_name -c collection_name  &#8211;type json &#8211;file complete path for the json file &#8211;jsonArray<\/h5>\r\n\r\n<a href=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\" alt=\"importData\" width=\"620\" height=\"100\" class=\"alignnone size-full wp-image-15581\" srcset=\"\/blog\/wp-content\/uploads\/2017\/01\/importData.png 620w, \/blog\/wp-content\/uploads\/2017\/01\/importData-150x24.png 150w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a>\r\n\r\n<b>Step 4:<\/b> Next, open another shell to run the command \u201c<b>mongo<\/b>\u201d.\r\n\r\n<a href=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/mongo.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/mongo.png\" alt=\"mongo\" width=\"620\" height=\"96\" class=\"alignnone size-full wp-image-15582\" srcset=\"\/blog\/wp-content\/uploads\/2017\/01\/mongo.png 620w, \/blog\/wp-content\/uploads\/2017\/01\/mongo-150x23.png 150w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a>\r\n\r\nNow we need to verify if our data has been imported correctly into the database or no. To do this, you need to execute the following commands:\r\n\r\n<ul>\r\n<li>Use the \u201c<b>show dbs<\/b>\u201d command to see your database. A list of the databases present is shown.<\/li>\r\n<li>From this list, select the required database using the \u201c<b>use database_name<\/b>\u201d command. <\/li>\r\n<li>Next, use the \u201c<b>show collections<\/b>\u201d command, which shows the collections inside your database.<\/li>\r\n<li>For seeing the contents of a specific collection, execute the \u201c<b>db.collection_name.find()<\/b>\u201d command .<\/li>\r\n<\/ul>\r\n\r\n<a href=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/mongoDatabase.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/mongoDatabase.png\" alt=\"mongoDatabase\" width=\"620\" height=\"279\" class=\"alignnone size-full wp-image-15583\" srcset=\"\/blog\/wp-content\/uploads\/2017\/01\/mongoDatabase.png 620w, \/blog\/wp-content\/uploads\/2017\/01\/mongoDatabase-150x68.png 150w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a>\r\n\r\nWith this, we are done with creating the database.\r\n\r\nNow lets move to the coding part that is a three-step process with, multiple sub-steps.\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"STEP_I_Configuration\"><\/span>STEP I (Configuration)<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\nCreate a file and save it as <b>config.php<\/b> inside the project folder.\r\n\r\n<ul>\r\n<li>Include the \u2018autoload.php\u2019  file that is required for using mongodb with php.\r\n <pre class=\"lang:php\">require 'vendor\\autoload.php';<\/pre><\/li>\r\n<li>Next, we need to create the connection between php and mongoDB.\r\n <pre class=\"lang:php\">$connection = new MongoDB\\Client;<\/pre><\/li>\r\n<\/ul>\r\n\r\nAfter completion of the configuration, the php code will  look like this.\r\n\r\n<pre class=\"lang:php\"><\/pre>\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"STEP_II\"><\/span>STEP II<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n<ul>\r\n<li>Extract the FusionCharts Suite XT zip and keep all the script files in a new folder inside the project folder, as shown below. Here, we have named the new folder as <b>fusioncharts<\/b>.<\/li>\r\n\r\n<li>Extract the fusioncharts PHP wrapper and keep the <b>fusioncharts.php<\/b> file inside the same folder created in the previous step for keeping the script files (for our example, fusioncharts).<\/li>\r\n<\/ul>\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"STEP_III_Main_Page\"><\/span>STEP III (Main Page)<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n<ul>\r\n<li>Create a file <b>multiseries_mongodb.php<\/b>, because we will be creating a multi-series chart using mongodb.  Include the config.php file inside this file, using the command shown below:\r\n<pre class=\"lang:php\">require 'config.php';<\/pre><\/li>\r\n\r\n<li>Include the \u2018<b>fusioncharts.php<\/b>\u2019  file that contains functions to embed fusioncharts in php.\r\n  <pre class=\"lang:php\">include(\"fusioncharts\/fusioncharts.php\")<\/pre><\/li>\r\n\r\n<li>Add the fusioncharts script file.\r\n<pre class=\"lang:markup\">&lt;hepad&gt;\r\n       \t&lt;script src=\"fusioncharts\/fusioncharts.js\"&gt;&lt;\/script&gt;\r\n        \t&lt;script src=\"fusioncharts\/fusioncharts.theme.fint.js\"&gt;&lt;\/script&gt;\r\n    &lt;\/hepad&gt;<\/pre><\/li>\r\n\r\n<li><b>Retrieve data from the database:<\/b> Include the php code within the body tag. First, retrieve the data from the database and store it in a variable. Here we are storing the data in a variable called <b>$myObj<\/b>.\r\n<pre class=\"lang:php\">myProject;\r\n$myObj = $db-&gt;chartData-&gt;find();\r\n?&gt;<\/pre>\r\nHere chartData is the collection name in the database myProject.<\/li>\r\n\r\n<li><b>Form an associative array:<\/b> As <b>$myObj<\/b> is a mongo cursor, we need to convert it to an associative array.\r\n<pre class=\"lang:php\">\/\/convert mongoCursor into an array\r\n    $data=iterator_to_array($myObj);<\/pre>\r\nThereafter, sort the associative array in an ascending order (if required).\r\n<pre class=\"lang:php\">asort($data);<\/pre><\/li>\r\n\r\n<li>Next, we will create an array that will contain the dataset\u2014the chart attributes and the data\u2014fetched from the database.\r\n<pre class=\"lang:php\">$categoryArray=array();\r\n            $dataseries1=array();\r\n            $dataseries2=array();\r\n            foreach ($data as $dataset) {\r\n                    array_push($categoryArray, array(\r\n                      \"label\" =&gt; $dataset[\"month\"]\r\n                    )\r\n                );\r\n                array_push($dataseries1, array(\r\n                    \"value\" =&gt; $dataset[\"petrol\"]\r\n                    )\r\n                );\r\n                array_push($dataseries2, array(\r\n                    \"value\" =&gt; $dataset[\"diesel\"]\r\n                    )\r\n                );\r\n            }\r\n$arrData = array(\r\n            \"chart\" =&gt; array(\r\n                \"caption\"=&gt; \"Comparison of Petrol and Diesel price\",\r\n                \"xAxisname\"=&gt; \"Month\",\r\n                \"yAxisName\"=&gt; \"Price\",\r\n                \"plotFillAlpha\"=&gt; \"80\",\r\n                \"showValues\"=&gt; \"0\",\r\n                \"bgcolor\"=&gt;\"#89C3C4\",\r\n                \"canvasbgcolor\"=&gt;\"#A0CBC2\",\r\n                \"paletteColors\"=&gt; \"#00B1C1,#0184B8\",\r\n                \"baseFont\"=&gt; \"Open Sans\",\r\n                \"showPlotBorder\"=&gt;\"1\",\r\n                \"theme\" =&gt; \"fint\"\r\n                )\r\n            );\r\n            $arrData[\"categories\"]=array(array(\"category\"=&gt;$categoryArray));\r\n                    \/\/ creating dataset object\r\n            $arrData[\"dataset\"] = array(array(\"seriesName\"=&gt; \"Petrol_price\", \"data\"=&gt;$dataseries1), array(\"seriesName\"=&gt; \"Diesel_price\",  \"renderAs\"=&gt;\"line\", \"data\"=&gt;$dataseries2)); <\/pre><\/li>\r\n\r\n<li>The associative array created in the above step will now have to be encoded into a json format that is required to render the chart.\r\n<pre class=\"lang:php\">$jsonEncodedData = json_encode($arrData);<\/pre><\/li>\r\n<li>Now, we create the chart object and render the chart using <b>render()<\/b> function.\r\n<pre class=\"lang:javascript\">$msChart = new FusionCharts(\"msline\",\"chart1\" , \"100%\", \"400\", \"chart-container\", \"json\", $jsonEncodedData);\r\n\r\n$msChart-&gt;render();<\/pre><\/li>\r\n\r\n<li>Next, we close the php tag and continue with the html part by defining the dom element, where the chart will render.\r\n<pre class=\"lang:markup\">&lt;div id=\"chart-container\"&gt;Fusion Charts will render here&lt;\/div&gt;<\/pre>\r\n<\/li>\r\n<li>Finally, execute the php code using any browser.\r\neg. https:\/\/localhost\/phpMongodb\/multiSeries_mongodb.php\r\n\r\nYour output should be like the image shown below:<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\nIf you see any errors in your code, click <a href=\"https:\/\/www.dropbox.com\/s\/66lbczbmq79xa77\/phpMongodb.zip?dl=0\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> to download the complete source code of the sample project we have created for this tutorial.","protected":false},"excerpt":{"rendered":"<p>PHP is one of the most widely used server side languages. We\u2019ve already got detailed documentation on how PHP can be easily integrated with FusionCharts using the FusionCharts-PHP wrapper. We also had a recent blog post on how you can use the Zend Framework (a cluster of PHP packages) with FusionCharts. PHP is fairly easy [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[604,607,250,265,283,606,605],"coauthors":[647,653],"class_list":["post-15572","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-create-charts-using-php-and-mongodb","tag-fusioncharts-php-wrapper","tag-mongodb","tag-nosql","tag-php","tag-php-driver-for-mongodb","tag-xampp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Charts Using PHP and MongoDB: 2026 Stack Tips<\/title>\n<meta name=\"description\" content=\"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world&#039;s most popular server-side language with modern data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Charts Using PHP and MongoDB: 2026 Stack Tips\" \/>\n<meta property=\"og:description\" content=\"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world&#039;s most popular server-side language with modern data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\" \/>\n<meta property=\"og:site_name\" content=\"FusionBrew - The FusionCharts Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-06T10:57:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-20T09:10:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2017\/01\/importData.png\" \/>\n\t<meta property=\"og:image:width\" content=\"620\" \/>\n\t<meta property=\"og:image:height\" content=\"100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Dishank Tiwari, Prerana Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dishank Tiwari, Prerana Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\/\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"Article\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Dishank Tiwari\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/9106ebef0b6b4fec8a2bb46862ee02ad\"\n\t            },\n\t            \"headline\": \"Create Charts Using PHP and MongoDB: 2026 Stack Tips\",\n\t            \"datePublished\": \"2017-01-06T10:57:37+00:00\",\n\t            \"dateModified\": \"2026-01-20T09:10:55+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\"\n\t            },\n\t            \"wordCount\": 963,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\",\n\t            \"keywords\": [\n\t                \"Create Charts using PHP and MongoDB\",\n\t                \"FusionCharts PHP Wrapper\",\n\t                \"MongoDB\",\n\t                \"NoSQL\",\n\t                \"php\",\n\t                \"PHP driver for MongoDB\",\n\t                \"XAMPP\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Tutorials\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\",\n\t            \"name\": \"Create Charts Using PHP and MongoDB: 2026 Stack Tips\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\",\n\t            \"datePublished\": \"2017-01-06T10:57:37+00:00\",\n\t            \"dateModified\": \"2026-01-20T09:10:55+00:00\",\n\t            \"description\": \"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world's most popular server-side language with modern data.\",\n\t            \"breadcrumb\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#breadcrumb\"\n\t            },\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\",\n\t            \"contentUrl\": \"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png\"\n\t        },\n\t        {\n\t            \"@type\": \"BreadcrumbList\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#breadcrumb\",\n\t            \"itemListElement\": [\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 1,\n\t                    \"name\": \"Home\",\n\t                    \"item\": \"https:\/\/www.fusioncharts.com\/blog\/\"\n\t                },\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 2,\n\t                    \"name\": \"Create Charts Using PHP and MongoDB: 2026 Stack Tips\"\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#website\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/\",\n\t            \"name\": \"FusionBrew - The FusionCharts Blog\",\n\t            \"description\": \"Get tips and tricks on how to build effective Data Visualisation using FusionCharts\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\/\/www.fusioncharts.com\/blog\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#organization\",\n\t            \"name\": \"FusionCharts\",\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/\",\n\t                \"url\": \"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg\",\n\t                \"contentUrl\": \"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg\",\n\t                \"width\": 1,\n\t                \"height\": 1,\n\t                \"caption\": \"FusionCharts\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/\"\n\t            }\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/9106ebef0b6b4fec8a2bb46862ee02ad\",\n\t            \"name\": \"Dishank Tiwari\",\n\t            \"image\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/image\/edab16f3ae97d48c528d1820c0597954\",\n\t                \"url\": \"\/blog\/wp-content\/wphb-cache\/gravatar\/589\/58951cd49296e6fe39049faab4be5f7cx96.jpg\",\n\t                \"contentUrl\": \"\/blog\/wp-content\/wphb-cache\/gravatar\/589\/58951cd49296e6fe39049faab4be5f7cx96.jpg\",\n\t                \"caption\": \"Dishank Tiwari\"\n\t            },\n\t            \"url\": \"https:\/\/www.fusioncharts.com\/blog\/author\/dishank-tiwari\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Charts Using PHP and MongoDB: 2026 Stack Tips","description":"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world's most popular server-side language with modern data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/","og_locale":"en_US","og_type":"article","og_title":"Create Charts Using PHP and MongoDB: 2026 Stack Tips","og_description":"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world's most popular server-side language with modern data.","og_url":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/","og_site_name":"FusionBrew - The FusionCharts Blog","article_published_time":"2017-01-06T10:57:37+00:00","article_modified_time":"2026-01-20T09:10:55+00:00","og_image":[{"width":620,"height":100,"url":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/2017\/01\/importData.png","type":"image\/png"}],"author":"Dishank Tiwari, Prerana Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dishank Tiwari, Prerana Singh","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#article","isPartOf":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/"},"author":{"name":"Dishank Tiwari","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/9106ebef0b6b4fec8a2bb46862ee02ad"},"headline":"Create Charts Using PHP and MongoDB: 2026 Stack Tips","datePublished":"2017-01-06T10:57:37+00:00","dateModified":"2026-01-20T09:10:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/"},"wordCount":963,"commentCount":0,"publisher":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png","keywords":["Create Charts using PHP and MongoDB","FusionCharts PHP Wrapper","MongoDB","NoSQL","php","PHP driver for MongoDB","XAMPP"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/","url":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/","name":"Create Charts Using PHP and MongoDB: 2026 Stack Tips","isPartOf":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage"},"image":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png","datePublished":"2017-01-06T10:57:37+00:00","dateModified":"2026-01-20T09:10:55+00:00","description":"Learn to create charts using PHP and MongoDB. Follow our 2026 stack tips and tricks to integrate the world's most popular server-side language with modern data.","breadcrumb":{"@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#primaryimage","url":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png","contentUrl":"https:\/\/www.fusioncharts.com\/blog\/wp-content\/uploads\/gallery\/blog\/2017\/01\/importData.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.fusioncharts.com\/blog\/create-charts-using-php-mongodb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fusioncharts.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create Charts Using PHP and MongoDB: 2026 Stack Tips"}]},{"@type":"WebSite","@id":"https:\/\/www.fusioncharts.com\/blog\/#website","url":"https:\/\/www.fusioncharts.com\/blog\/","name":"FusionBrew - The FusionCharts Blog","description":"Get tips and tricks on how to build effective Data Visualisation using FusionCharts","publisher":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fusioncharts.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.fusioncharts.com\/blog\/#organization","name":"FusionCharts","url":"https:\/\/www.fusioncharts.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/","url":"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg","contentUrl":"\/blog\/wp-content\/uploads\/2020\/03\/idera-fc-logo.svg","width":1,"height":1,"caption":"FusionCharts"},"image":{"@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/9106ebef0b6b4fec8a2bb46862ee02ad","name":"Dishank Tiwari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fusioncharts.com\/blog\/#\/schema\/person\/image\/edab16f3ae97d48c528d1820c0597954","url":"\/blog\/wp-content\/wphb-cache\/gravatar\/589\/58951cd49296e6fe39049faab4be5f7cx96.jpg","contentUrl":"\/blog\/wp-content\/wphb-cache\/gravatar\/589\/58951cd49296e6fe39049faab4be5f7cx96.jpg","caption":"Dishank Tiwari"},"url":"https:\/\/www.fusioncharts.com\/blog\/author\/dishank-tiwari\/"}]}},"_links":{"self":[{"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/posts\/15572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/comments?post=15572"}],"version-history":[{"count":0,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/posts\/15572\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/media?parent=15572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/categories?post=15572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/tags?post=15572"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.fusioncharts.com\/blog\/wp-json\/wp\/v2\/coauthors?post=15572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}