{"id":28465664,"url":"https://github.com/iolo/mongolfier","last_synced_at":"2025-06-29T16:32:16.556Z","repository":{"id":57301894,"uuid":"5304195","full_name":"iolo/mongolfier","owner":"iolo","description":"**DEPRECATED** mysql to mongodb migration tool","archived":false,"fork":false,"pushed_at":"2015-11-16T01:33:38.000Z","size":155,"stargazers_count":13,"open_issues_count":3,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-17T12:41:25.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iolo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-05T14:33:08.000Z","updated_at":"2019-08-13T15:07:17.000Z","dependencies_parsed_at":"2022-09-11T08:03:35.267Z","dependency_job_id":null,"html_url":"https://github.com/iolo/mongolfier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iolo/mongolfier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongolfier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongolfier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongolfier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongolfier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iolo","download_url":"https://codeload.github.com/iolo/mongolfier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongolfier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262432342,"owners_count":23310226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-07T06:07:01.149Z","updated_at":"2025-06-29T16:32:16.544Z","avatar_url":"https://github.com/iolo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"DEPRECATION NOTICE\n==================\n\nThis project is abandoned.\n\nmongolfier\n==========\n\nA Simple MySQL to MongoDB Migration Tool\n\n![Montgolfier Balloon](http://goo.gl/hV1pM)\n\nNOTE: not \"montgolfier\" but \"mongolfier\". ;)\n\ninstall and run\n---------------\n\n### local install and run\n\n```\n$ npm install mongolfier\n$ node ./node_modules/.bin/mongolfier --help\n```\n\n### global install and run\n\n```\n$ npm install -g mongolfier\n$ mongolfier --help\n```\n\n### simple migration with bulk-copy\n\nTo copy all rows from `users` table on `test` mysql database\ninto `users` collection on `test` mongo db.\n\n```\n$ mongolfier -s mysql://root@localhost/test -o mongodb://localhost/test -b users\n```\n\n**NOTE** use `-d` flag to test WITHOUT real `insert` operations:\n\n```\n$ mongolfier -s mysql://root@localhost/test -o mongodb://localhost/test -b -d users\n```\n\n**NOTE** use `-e` flag to remove all existing documents in the collection:\n\n```\n$ mongolfier -s mysql://root@localhost/test -o mongodb://localhost/test -b -e users\n```\n\n### complex migration with template(EXPERIMENTAL)\n\nFor complex migration,\nyou need to write a config file and template files and use `-c` option:\n\n```\n$ mongolfier -c config.json\n```\n\nusage\n-----\n\n```\n$ mongolfier -help\n  Usage: mongolfier [OPTIONS] [COLLECTION_NAME ...]\n\n  Options:\n\n    -h, --help              output usage information\n    -V, --version           output the version number\n    -c, --config [FILE]     path to config file(js or json)\n    -s, --mysql [URL]       mysql connection url\n    -o, --mongo [URL]       mongodb connection url\n    -e, --empty-collection  make empty collection before migration\n    -b, --bulk-copy         do bulk copy if no template available\n    -d, --dry-run           do not insert into collection\n```\n\nconfiguration\n-------------\n\n### config file(json)\n\n* NOTE: no comment allowed here. this file should conforms to *strict* json format.\n* NOTE: `{{` and `}}` is just a marker. replace it with yours.\n\n```javascript\n{\n  \"mysql\": \"mysql://user:password@host:port/database\",\n  \"mongo\": \"mongodb://user:password@host:port/db\",\n  \"context\": {\n    \"{{custom_attr_key}}\": \"{{custom_attr_value}}\",\n    ...\n  },\n  \"before\": [\n    \"{{before_script.js}}\",\n    ...\n  ],\n  \"after\": [\n    \"{{after_script.js}}\",\n    ...\n  ]\n  \"collections\": [\n    {\n      \"collection\": \"{{mongo_collection_name}}\",\n      \"template\": \"{{path_to_collection_template}}\",\n      \"query\": \"{{mysql_select_query}}\"\n    },\n    {\n      \"collection\": \"{{mongo_collection_name}}\",\n      \"template\": \"{{path_to_collection_template}}\",\n      \"query\": [\n        \"{{mysql_select_query_part1}}\",\n        \"{{mysql_select_query_part2}}\",\n        ...\n      ]\n    },\n    ...\n  ]\n}\n```\n\n* `context` is optional. this could be accessed via `$` variable across processing all collections.\n* `before` is optional. these scripts are *eval*ulated before processing the first collection.\n* `after` is optional. these scripts are *eval*ulated after processing the last collection.\n* `template` is optional(default: `{{collection name}}.json`).\n* `query` is string or array. array will be *join*ed to a query.\n\n### mapping template/script\n\n\u003e NOTE: comment allowed here. this file is javascript or something. ;)\n \n\u003e NOTE: `{{` and `}}` is just a marker. replace it with yours.\n\n#### simple mapping template\n\n```javascript\n({\n  // use mongodb ObjectID\n  \"_id\": new mongo.ObjectID(),\n  // use mysql column values\n  \"{{mongo_field_name}}\": ${{mysql_column_name}},\n  ...\n})\n```\n\n#### complex mapping template\n\n```javascript\nvar id = new mongo.ObjectID();\n...\n({\n  \"_id\": id,\n  \"foo\": ($bar).toUpperCase(),\n  \"sum\": $num1 + $num2,\n  \"now\": new Date(),\n  ...\n})\n```\n\n* NOTE on the enclosing braces the result. do not use `return` keyword.\n\n#### async mapping template(EXPERIMENTAL)\n\n```javascript\nvar d = q.defer();\nvar id = new mongo.ObjectID();\nsetTimeout(function () {\n  ...\n  d.resolve({\n    \"_id\": id,\n    \"foo\": ($bar).toUpperCase(),\n    \"sum\": $num1 + $num2,\n    \"now\": new Date(),\n    ...\n  })\n}, 100);\nd.promise;\n```\n\n* NOTE on the last line `d.promise;`. do not use `return` keyword.\n\n#### predefined objects\n\n* `$ROW` - the current mysql row as object.\n* `$COLLECTION` - the current mongo collection as object.\n* `$MYSQL` - the active [mysql connection](https://github.com/felixge/node-mysql/).\n* `$MONGO` - the active [mongo connection](http://mongodb.github.com/node-mongodb-native/api-generated/db.html).\n* `$CONTEXT` - a shared object across all mappings.\n* `mongo` - [mongo module](http://mongodb.github.com/node-mongodb-native/)\n* `mysql` - [mysql module](https://github.com/felixge/node-mysql/)\n* `console` - [console object](http://nodejs.org/api/stdio.html)\n* `util` - [util module](http://nodejs.org/api/util.html)\n* `fs` - [fs module](http://nodejs.org/api/fs.html)\n* `path` - [path module](http://nodejs.org/api/path.html)\n* `Q` - [q module](https://github.com/kriskowal/q/)\n* `_` - [lodash module](http://lodash.com).\n* and so on...\n\nTBD... ;)\n\n----\n\nThat's all folks.\n\nMay the SOURCE be with you...\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fmongolfier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiolo%2Fmongolfier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fmongolfier/lists"}