MySQL export to MongoDB
There are a method that doesn't require you to use any other software than mysql and mongodb utilities. The disadvantage is that you have to go table by table, but in your case you only need to migrate one table, so it won't be painful.
I followed this tutorial. Relevant parts are:
Get a CSV with your data. You can generate one with the following query in mysql.
SELECT [fields] INTO outfile 'user.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' FROM [table]
- Finally, import the file using
mongoimport
. That's all
If you're using Ruby, you can also try: Mongify
It will read your mysql database, build a translation file and allow you to map the information.
It supports:
- Updating internal IDs (to BSON ObjectID)
- Updating referencing IDs
- Type Casting values
- Embedding Tables into other documents
- Before filters (to change data manually)
- and much much more...
Read more about it at: http://mongify.com/getting_started.html