Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 719 Bytes

README.md

File metadata and controls

25 lines (18 loc) · 719 Bytes

Overview

This node.js script allows the conversion of a mysqldump file to JSON, which is useful for importing data into MongoDB. A mysqldump can generally be performed using this command:

mysqldump database_name_here -u root -p > output.sql

See this link for more info on mysqldump: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Once you have the dump.sql file, run this command to generate output.json:

node converter.js dump.sql

The converter will create a json file per table/collection. You can now import the json file to mongo via this command:

mongoimport --type json --jsonArray --db db_name_here --collection collection_name_here --file file_name_here.json