MongoDB

Connect and get data from MongoDB.

Introduction

This package allows you to connect and get data from MongoDB.

Installation

  1. Download the zip file.
  2. Unzip
  3. Copy folder mongodb to the folder koolreport/packages

Documentation

Settings

Nametypedefaultdescription
classstring Must set to '\koolreport\mongodb\MongoDataSource'
connectionStringstringDefine connection string to MongoDB. If you use connectionString, you do not need to use properties host, username and password.
hoststringMongoDB host
usernamestringUsername
passwordstringPassword
databasestringThe name of database you want to connect

Example


<?php
class MyReport extends \koolreport\KoolReport
{
    public function settings()
    {
        return array(
            "dataSources"=>array(
                "mongo_purchase"=>array(
                    "class"=>'\koolreport\mongodb\MongoDataSource',
                    "connectionString"=>"mongo://johndoe:secret_password@localhost:65432",
                    "database"=>"dbpurchase"
                ),
            )
        );
    }
    public function setup()
    {
        $this->src('mongo_purchase')
        ->query(array("collection"=>"cPurchases"))
        ->pipe(..)
        ->pipe(...)
        ...
        ->pipe($this->dataStore('mongo_purchases'));
    }
}

Support

Please use our forum if you need support, by this way other people can benefit as well. If the support request need privacy, you may send email to us at support@koolreport.com.

User Reviews
(2)
Glourise
on Oct 3, 2017

It works like charm!

Satya
on Apr 12

Hi, I am getting following error, Please suggest us Fatal error: Class '\koolreport\datasources\MongoDataSource' not found in C:\xampp\htdocs\mongoex\koolreport\KoolReport.php on line 194