Error import data into atlas cluster

Dear Sir

I have difficulties, to import into my cluster, the file “data”

Hi @DMagalhaes,

It looks like you’ve surrounded your URI string with <>. These square brackets are not necessary.

Also, you cannot use the flags --username and --password when using an SRV string. Instead, you must include the username and password in the string. Try this command instead:

mongorestore --drop --gzip --uri mongodb+srv://m220student:m220password@mflix-ercgg.mongodb.net/test data

I hope this helps.

12 Likes

Also I have import error: I used following connection string, I can connected the database

propel@pdasbox:~/works/m220/mflix-python$ mongo “mongodb+srv://m220student:m220password@mflix-bbnpx.mongodb.net”
MongoDB shell version v3.6.2
connecting to: mongodb+srv://mflix-bbnpx.mongodb.net
2018-09-19T22:33:47.865-0400 I NETWORK [thread1] Starting new replica set monitor for mflix-shard-0/mflix-shard-00-01-bbnpx.mongodb.net.:27017,mflix-shard-00-02-bbnpx.mongodb.net.:27017,mflix-shard-00-00-bbnpx.mongodb.net.:27017
2018-09-19T22:33:55.992-0400 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to mflix-shard-00-02-bbnpx.mongodb.net.:27017 (1 connections now open to mflix-shard-00-02-bbnpx.mongodb.net.:27017 with a 5 second timeout)
2018-09-19T22:33:56.004-0400 I NETWORK [thread1] Successfully connected to mflix-shard-00-01-bbnpx.mongodb.net.:27017 (1 connections now open to mflix-shard-00-01-bbnpx.mongodb.net.:27017 with a 5 second timeout)
2018-09-19T22:34:04.121-0400 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to mflix-shard-00-00-bbnpx.mongodb.net:27017 (1 connections now open to mflix-shard-00-00-bbnpx.mongodb.net:27017 with a 5 second timeout)
2018-09-19T22:34:04.134-0400 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] changing hosts to mflix-shard-0/mflix-shard-00-00-bbnpx.mongodb.net:27017,mflix-shard-00-01-bbnpx.mongodb.net:27017,mflix-shard-00-02-bbnpx.mongodb.net:27017 from mflix-shard-0/mflix-shard-00-00-bbnpx.mongodb.net.:27017,mflix-shard-00-01-bbnpx.mongodb.net.:27017,mflix-shard-00-02-bbnpx.mongodb.net.:27017
2018-09-19T22:34:04.138-0400 I NETWORK [thread1] Successfully connected to mflix-shard-00-00-bbnpx.mongodb.net.:27017 (1 connections now open to mflix-shard-00-00-bbnpx.mongodb.net.:27017 with a 5 second timeout)
2018-09-19T22:34:12.222-0400 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to mflix-shard-00-02-bbnpx.mongodb.net:27017 (1 connections now open to mflix-shard-00-02-bbnpx.mongodb.net:27017 with a 5 second timeout)
2018-09-19T22:34:12.248-0400 I NETWORK [thread1] Successfully connected to mflix-shard-00-01-bbnpx.mongodb.net:27017 (1 connections now open to mflix-shard-00-01-bbnpx.mongodb.net:27017 with a 5 second timeout)
MongoDB server version: 3.6.7
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise mflix-shard-0:PRIMARY> db
test
MongoDB Enterprise mflix-shard-0:PRIMARY>

but using the same string to restore data I got error:

propel@pdasbox:~/works/m220/mflix-python$ mongorestore --drop --gzip --uri mongodb+srv://m220student:m220password@mflix-bbnpx.mongodb.net/test data
2018-09-19T22:42:14.371-0400 error parsing command line options: error parsing uri (mongodb+srv://m220student:m220password@mflix-bbnpx.mongodb.net/test): lookup _mongodb._tcp.mflix-bbnpx.mongodb.net on 192.168.1.1:53: dial udp 192.168.1.1:53: i/o timeout
2018-09-19T22:42:14.372-0400 try ‘mongorestore --help’ for more information

Not sure why?
-Yiding

Hi YidingZhang,

This command (copied from your terminal output) works for me:

mongorestore --drop --gzip --uri mongodb+srv://m220student:m220password@mflix-bbnpx.mongodb.net/test data

The version of mongorestore on your machine might be out-of-date. Have you tried downloading the newest version? You can download all MongoDB binaries, including mongorestore, from the download center.

Let me know if this helps!

Matt

1 Like

MongoDB Enterprise Cluster0-shard-0:PRIMARY> mongorestore --drop --gzip --uri mongodb+srv://userid:password@cluster0-ecwkm.gcp.mongodb.net/test data

is this command correct? because I am unable to get any output after that

Thank you.

Hi Pranali_Prakash_84850,

Your command seems right.
You need to run mongorestore command outside your Mongo shell.

Thanks, Kanika

Thanks kanikasingla!
It’s working

Hi Matt,

My Mongo Shell’s version is 3.4 or earlier. But mongorestore command given is for versions above 3.6 or later. Could you please tell me how my command should look like?

When I chose ‘I am using Mongo Shell 3.4 or earlier’ under Connect via the Mongo Shell option, I am getting the following command. Please let me know how I should modify this to load the data.

mongo “mongodb://mflix-shard-00-00-j9tgj.mongodb.net:27017,mflix-shard-00-01-j9tgj.mongodb.net:27017,mflix-shard-00-02-j9tgj.mongodb.net:27017/test?replicaSet=mflix-shard-0” --ssl --authenticationDatabase admin --username m220student --password

Thanks,
Shahul

I could resolve this by myself. Thanks.

Hi mjshaheed,

Glad to hear you got it working.

this really helped me ! Thanks a lot !

Mongorestore gives the error:
error parsing command line options: error parsing uri (mongodb+srv://m220student:m220password@mflix-eiv9p.mongodb.net/test): lookup _mongodb._tcp.mflix-eiv9p.mongodb.net on 127.0.0.53:53: no such host

I run the the command from shell:
mongorestore --drop --gzip --uri mongodb+srv://m220student:m220password@mflix-eiv9p.mongodb.net/test data

Please help me out of this issue

Have you tried connecting to you Atlas cluster using the shell first ?

mongorestore --drop --gzip --uri “mongodb+srv://m220student:m220password@mflix-eiv9p.mongodb.net/test” data

You will have to use quotes around the uri.

mongodb+srv://m220student:m220password@mflix-eiv9p.mongodb.net/test

does not work

but full connection string (standard connection string shell 3.4+) works and able to connect with this uri
my
MongoDB shell version v4.0.1

mongorestore --drop --gzip --uri “mongodb+srv://m220student:m220password@mflix-eiv9p.mongodb.net/test” data

copy paste this code in your virtual environment it should work, I just finished importing data to my cluster using the same.

Try it if it doesn’t work let me know.

with quotes also shows same error

can you post a screen shot.

do i need virtual env for this step?

yes you need to activate the virtual env in the command prompt and then try the command.