2017 © Pedro Peláez
 

library mysql-to-mongodb

A Console Commands To Help With Data Migration From mysql To mongodb.

image

ctf0/mysql-to-mongodb

A Console Commands To Help With Data Migration From mysql To mongodb.

  • Wednesday, July 18, 2018
  • by ctf0
  • Repository
  • 2 Watchers
  • 6 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Mysql To MongoDb
Latest Stable Version Total Downloads

I made this tool as i was starting to learn mongodb and i couldnt find any decent alternative. br/ The tool is working as expected and even tested on a live working app that uses mysql, however i strongly recommend that you use this package with a grain of salt., (*1)

Installation

  • composer require ctf0/mysql-to-mongodb, (*2)

  • (Laravel < 5.5) add the service provider, (*3)

    'providers' => [
        ctf0\MysqlToMongoDb\MysqlToMongoDbServiceProvider::class,
    ]
    

Usage

mongo:migrate            # clone mysql data to mongodb
mongo:migrate:pivot      # resolve pivot foreign ids (ManyToMany)
mongo:migrate:relation   # resolve foreign ids (OneToMany)
mongo:migrate:cleanup    # remove un-wanted field/collection from the db
mongo:migrate:maintain   # backup/restore mongo db (mongodump / mongorestore)

Wiki, (*4)

Notes

  • if you havent installed mongodb yet, check http://wp.me/p4DYee-9Q
  • make sure that you can connect to both of your dbs through laravel without any issues.
  • the package assume that your mysql driver connection is mysql and your default driver connection is mongodb.
  • the package doesnt recreate the table types from mysql, and its up to mongodb to decide at that point, however currently the below types gets converted on migration, (*5)

    • tinyint(1) => bool
    • timestamp => date
    • multi(OneToMany) => index
    • unique => index/unique/sparse, (*6)

      having a field with the same name in 2 different collections will give an error, so as a-way-around the index is saved as (CollectionName_field), (*7)

  • all your app calls to id should be changed to _id except in view which is automatically converted through the model., (*8)

  • moloquent use string for the relation linking/referencing, so when converting the foreign_ids to ObjectId now you will have string on one side and ObjectId on the other which will cause lots of trouble, so its kept as string.

ToDo

  • Find Away To Add Data In Bulk Instead Of One By One.
  • Upload Db Backup To S3.
  • Make A Small GUI For Easier Migration.

The Versions

18/07 2018

dev-master

9999999-dev https://github.com/ctf0/MysqlToMongoDb

A Console Commands To Help With Data Migration From mysql To mongodb.

  Sources   Download

MIT

The Requires

 

by Muah

mongodb laravel mysql data migration ctf0 mysqltomongodb

05/05 2018

v1.0.2

1.0.2.0 https://github.com/ctf0/MysqlToMongoDb

A Console Commands To Help With Data Migration From mysql To mongodb.

  Sources   Download

MIT

The Requires

 

by Muah

mongodb laravel mysql data migration ctf0 mysqltomongodb

09/04 2018

v1.0.1

1.0.1.0 https://github.com/ctf0/MysqlToMongoDb

A Console Commands To Help With Data Migration From mysql To mongodb.

  Sources   Download

MIT

The Requires

 

by Muah

mongodb laravel mysql data migration ctf0 mysqltomongodb

19/06 2017

v1.0.0

1.0.0.0 https://github.com/ctf0/MysqlToMongoDb

A Console Commands To Help With Data Migration From mysql To mongodb.

  Sources   Download

MIT

The Requires

 

by Muah

ctf0 mysqltomongodb