Giter VIP home page Giter VIP logo

mongodb's Introduction

Introduction

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

Installation

By downloading .zip file

  1. Download
  2. Unzip the zip file
  3. Copy the folder mongodb into koolreport folder so that look like below
koolreport
├── core
├── mongodb

By composer

composer require koolreport/mongodb

Documentation

Settings

Name type default description
class string Must set to '\koolreport\mongodb\MongoDataSource'
connectionString string Define connection string to MongoDB. If you use connectionString, you do not need to use properties host, username and password.
host string MongoDB host
username string Username
password string Password
database string The 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',
            'find' => ['age' => ['$gte' => '40']],
            'options' => [
                'skip' => 0,
                'limit' => 5,
                'projection' => [
                    '_id' => 0,
                    'name' => 1,
                    'age' => 1,
                ],    
            ],
        ))
        ->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 [email protected].

mongodb's People

Contributors

dongnl avatar tuananhnghiem avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.