PHP Classes

File: MySqlToMongo_test.php

Recommend this page to a friend!
  Classes of Orazio Principe   PHP MySQL to Mongo   MySqlToMongo_test.php   Download  
File: MySqlToMongo_test.php
Role: Example script
Content type: text/plain
Description: Example file
Class: PHP MySQL to Mongo
Import MySQL database into MongoDB
Author: By
Last change:
Date: 8 years ago
Size: 932 bytes


Class file image Download


$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pswd = "";
$mysql_database = "test";

$mongo_host = "localhost";
$mongo_user = "";
$mongo_pswd = "";
$mongo_database = "test";

$imp = new MySqlToMongo();

//Establishing connections to mysql and mongo instances
$imp->mysql_connect($mysql_host, $mysql_user, $mysql_pswd, $mysql_database);
$imp->mongodb_connect($mongo_host, $mongo_user, $mongo_pswd, $mongo_database);

//Set the number of concurrent records to insert

//Set debug mode to read debug messages

//Get all tables from the database
//if you want to import single tables just pass an array of names ex: $list("tbl1","tbl2")
$tables = $imp->getMySqlTables();

//Set the dropping tables if exists into mongo. If false it will append records

//Starting import session