Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active November 28, 2015 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanusdad/e7e778eafb65cd35a41c to your computer and use it in GitHub Desktop.
Save nanusdad/e7e778eafb65cd35a41c to your computer and use it in GitHub Desktop.
MySQL to mongo in Meteor

Export to CSV from MySQL

SELECT * FROM books INTO OUTFILE '/tmp/books.csv'  
FIELDS TERMINATED BY ','  
ENCLOSED BY '"'  
LINES TERMINATED BY '\n'

Note fields in books table

DESC books;

Edit books.csv and add headerline

  • which is comma separated list of fields from above

With meteor running - import using the command below

mongoimport -h localhost:3001 --db meteor --collection books --headerline --type csv -file books.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment