Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to mongoimport data to deployed meteor app?

Tags:

mongodb

meteor

UPDATE: this post applied to meteor.com free hosting, which has been shutdown and replaced with Galaxy, a paid Meteor hosting service

I'm using this command

C:\kanjifinder>meteor mongo --url kanjifinder.meteor.com

to get access credentials to my deployed mongo app, but I can't get mongoimport to work with the credentials. I think I just don't exactly understand which part is the username, password and client. Could you break it down for me?

result from server (I modified it to obfuscate the real values):

mongodb://client:[email protected]:27017/kanjifinder_meteor_com

my mongoimport attempt (fails authentication):

C:\mongodb\bin>mongoimport -h meteor.m0.mongolayer.com:27017 -u client -p e63aaade-xxxx-yyyy-93e4-de0c1b80416f --db meteor --collection kanji --type csv --file c:\kanjifinder\kanjifinder.csv --headerline
like image 777
Max Hodges Avatar asked Mar 12 '13 18:03

Max Hodges


2 Answers

OK got it. This helped: http://docs.mongodb.org/manual/reference/connection-string/

mongoimport --host meteor.m0.mongolayer.com --port 27017 --username client --password e63aaade-xxxx-yyyy-93e4-de0c1b80416f --db kanjifinder_meteor_com --collection kanji --type csv --file c:\kanjifinder\kanjifinder.csv --headerline
like image 61
Max Hodges Avatar answered Sep 20 '22 12:09

Max Hodges


Using mongodump and mongorestore also works:

  1. Dump data from existing mongodb (mongodb url: mongodb://USER:PASSWORD@DBHOST/DBNAME)

    mongodump -h DBHOST -d DBNAME -u USER -p PASSWORD
    

    This will create a "dump" directory, with all the data going to dump/DBNAME.

  2. Get the mongodb url for the deployed meteor app (i.e. www.mymeteorapp.com)

    meteor mongo --url METEOR_APP_URL
    

    Note: the PASSWORD expires every min.

  3. Upload the db dump data to the meteor app (using an example meteor db url)

    mongorestore -u client -p dcc56e04-a563-4147-eff4-5ae7c1253c9b -h production-db-b2.meteor.io:27017 -db www_mymeteorapp_com dump/DBNAME/
    

    All the data should get transferred!

like image 31
davidd8 Avatar answered Sep 20 '22 12:09

davidd8