PHPackages                             ctf0/mysql-to-mongodb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ctf0/mysql-to-mongodb

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

ctf0/mysql-to-mongodb
=====================

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

v1.0.2(8y ago)15601MITPHPPHP &gt;=5.5.9

Since Jun 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ctf0/MysqlToMongoDb)[ Packagist](https://packagist.org/packages/ctf0/mysql-to-mongodb)[ Docs](https://github.com/ctf0/MysqlToMongoDb)[ RSS](/packages/ctf0-mysql-to-mongodb/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

 Mysql To MongoDb
 [![Latest Stable Version](https://camo.githubusercontent.com/f56f7217879b6e4fe2e7ef2979de11b68294bcc28f00c922458df2767c17b9dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637466302f6d7973716c2d746f2d6d6f6e676f64622e737667)](https://packagist.org/packages/ctf0/mysql-to-mongodb) [![Total Downloads](https://camo.githubusercontent.com/208274526f390de7634496f0f48f2842249114170639cd5eaca203e8e3b7ceba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637466302f6d7973716c2d746f2d6d6f6e676f64622e737667)](https://packagist.org/packages/ctf0/mysql-to-mongodb)
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#----mysql-to-mongodb---------)

I made this tool as i was starting to learn mongodb and i couldnt find any decent alternative.
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.

Installation
------------

[](#installation)

- `composer require ctf0/mysql-to-mongodb`
- (Laravel &lt; 5.5) add the service provider

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

Usage
-----

[](#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](https://github.com/ctf0/MysqlToMongoDb/wiki/Usage)

Notes
-----

[](#notes)

- if you havent installed mongodb yet, check
- 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

    - `tinyint(1) => bool`
    - `timestamp => date`
    - `multi(OneToMany) => index`
    - `unique => index/unique/sparse`

        **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)**
- all your app calls to `id` should be changed to `_id` except in view which is automatically converted through the model.
- `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
----

[](#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.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~160 days

Total

3

Last Release

2977d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.4

v1.0.1PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/51dbfff65441e32301575f8ac241895817975e754d15574b86f543b33f1961f6?d=identicon)[ctf0](/maintainers/ctf0)

---

Top Contributors

[![ctf0](https://avatars.githubusercontent.com/u/7388088?v=4)](https://github.com/ctf0 "ctf0 (46 commits)")

---

Tags

database-migrationslaravelmongodbmysqllaravelmysqlmongodbctf0data migrationMysqlToMongoDb

### Embed Badge

![Health badge](/badges/ctf0-mysql-to-mongodb/health.svg)

```
[![Health](https://phpackages.com/badges/ctf0-mysql-to-mongodb/health.svg)](https://phpackages.com/packages/ctf0-mysql-to-mongodb)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M282](/packages/laravel-horizon)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.0M88](/packages/mongodb-laravel-mongodb)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[danielme85/laravel-log-to-db

Custom Laravel Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel native logging functionality.

134979.2k1](/packages/danielme85-laravel-log-to-db)[lemaur/eloquent-publishing

207.8k1](/packages/lemaur-eloquent-publishing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
