user592419
user592419

Reputation: 5223

How can I mongoimport with Meteor?

I made a mongoexport of some local data that I now want to mongoimport into production. I'm trying the following command:

mongoimport -h production-db-b2.meteor.io --port 27017 --username client --password password_that_expires_fast --collection collection_name --db prod_meteor_com --file ./mongo_import.json

This appears to be quite similar to the solution posted here: how to mongoimport data to deployed meteor app?

However, it's not working with the error couldn't connect to [production-db-b2.meteor.io:27017] couldn't connect to server production-db-b2.meteor.io:27017

How do I get around this?

(Note: I also tried concatenating the port and host into -h production-db-b2.meteor.io:27017 to no avail)

Upvotes: 2

Views: 1533

Answers (2)

aaron p
aaron p

Reputation: 443

check your port. the local meteor mongodb uses 3001 not 27017...

i'm using the following line successfully

mongoimport --host localhost:3001 -d meteor -c TestCollection --type csv --file /home/ubuntu/meteorMongoImportTest/results1.txt --headerline

Upvotes: 1

Spencer
Spencer

Reputation: 942

This is what worked for me in the past. I'm not exactly sure of why it works and your solution doesn't, but I think it has something to do with not specifying the collection or the file in a certain way.

mongoimport -u client -h production-db-b2.meteor.io:27017 -d myapp_meteor_com -p passwordthatexpiresreallyfast /pathtofile 

Upvotes: 1

Related Questions