how can I import a *.json importing remotely?

33 views
Skip to first unread message

Beth Morgan

unread,
Aug 4, 2017, 10:50:39 AM8/4/17
to mongodb-user
hello,
I cannot import my data remotely..i keep getting an error:  im using mongodb Atlas:  https://cloud.mongodb.com

2017-08-04T07:50:43.695-0400    [........................] allYears.uKPostal    0B/1001MB (0.0%)
2017-08-04T07:50:43.735-0400    [........................] allYears.uKPostal    0B/1001MB (0.0%)
2017-08-04T07:50:43.735-0400    Failed: error connecting to db server: no reachable servers
2017-08-04T07:50:43.738-0400    imported 0 documents


my commandline command:
 mongoimport --host "mongodb://productioncluster-shard-00-00-tcdnn.mongodb.net:27017,productioncluster-shard-00-01-tcdnn.mongodb.net:27017,productioncluster-shard-00-02-tcdnn.mongodb.net:27017/test?replicaSet=ProductionCluster-shard-0" --authenticationDatabase admin --ssl --username XXXXX --password XXXXXXX --db allYears --collection uKPostal --drop --file unit.json

Kevin Adistambha

unread,
Aug 7, 2017, 2:01:26 AM8/7/17
to mongodb-user

Hi Beth

The error message means that mongoimport cannot connect to the MongoDB deployment. This is because the --host parameter of mongoimport does not recognize MongoDB URI format (there is --uri parameter for that purpose instead). The --host parameter requires mongodb host to connect to (e.g. replicasetname/host1,host2 for replica sets).

You would need to modify your parameters to be:

mongoimport --host "ProductionCluster-shard-0/productioncluster-shard-00-00-tcdnn.mongodb.net:27017,productioncluster-shard-00-01-tcdnn.mongodb.net:27017,productioncluster-shard-00-02-tcdnn.mongodb.net:27017" --authenticationDatabase admin --ssl --username=XXXXX --password=XXXXXXX --db=allYears --collection=uKPostal --drop --file=unit.json

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages