Error importing data with mongorestore using mongodb 3.4

I’m using MongoDB 3.4 and I can’t figure out how to import data using mongorestore. It gives me an error every time I try to import using the standar connection string 3.4. The short srv conn doesn’t work to me obviuosly.

I have tried :slight_smile:
mongorestore --drop --gzip --uri <MY ENTIRE URI 3.4> data
mongorestore --drop --gzip --uri <MY ENTIRE URI 3.4> --ssl --authenticationDatabase admin --username m220student --password m220password" data

Any help ?

P.D.: The Standar Connection String for Mongodb 3.4 works perfectly

Pay particular attention to New in version 3.6.

After read a lot and try some options, I found a solution for this cases using mongodb 3.4

Running in the mflix root path:
mongorestore --drop --gzip --ssl --host mflix-shard-0/,, --authenticationDatabase admin --dir=data -u m220student --password m220password

in the host options I did set first the shard, then added a slash and all the cluster path, at the end I added params for auth, directory, user, password… and it work

thank for your help canelacho it works i have just delete shard1 and shard2

1 Like

Hi, I’m having the same problem with mongorestore. When I enter mongorestore --drop --gzip --ssl --host with my,," --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics it gives me an Failed: error connecting to db server: no reachable servers.

What am I missing? Any clues?

I have found solution described on this link: Import data with mongorestore command

Try to set first the replicaset then add a slash then the cluster, don’t use quotes. Try to copy my connection string. And if you have success, you hace to Edit the string connection in the .ENV using parameters whit the simbol &.

I would strongly suggest NOT using the MongoDB 3.4 tools for mongorestore or mongo even for the purpose of this course, if not in general.

The simple reasoning is:

  1. Tools are always backwards compatible, but never forwards compatible, so running a latest version is always preferred.

  2. It’s a very simple matter to install the tools ( ie mongorestore, mongobackup etc ) or even shell even completely separately from the server installation on all platforms. Linux variants and Mac OS have separate packages, and Windows installers do allow component selection. So it’s easy to do.

  3. Aside from “supported features” the latest versions of tools are already free of bugs that may be present in older and “possibly unsupported” versions.

Bottom line is that even if you have a requirement to have an older MongoDB server version installed on a machine, there is no valid reason that your tools should not be updated to the most recent version.

IMHO At the very least any tools should be from a 3.6 version ( and I believe the course notes did ask you to do this ) as I personally would be very nervous of even any production dependency that was about to hit end of life for official support within a 12 month period.

3.4 has little over 6 months until that deadline.