3

I am using MongoDB 3.6 and am having trouble understanding how to use mongorestore on an .agz file. If I specify the below, then I get an error saying Failed: error connecting to db server: no reachable servers

mongorestore --gzip --archive=<filename>.agz --db test

And when I use the below command, specifying the actual mongod instance, I don't get any errors and actually see the status preparing collections to restore from, but I don't see anything in the actual mongod instance

mongorestore --gzip --archive=<filename>.agz --db test -u <username> -p <password> --authenticationDatabase 'admin' --port 27000 --host <hostname>

What am I supposed to be doing instead?

1 Answer 1

2

I figured out my issue.....The second command that I listed above (with the username and password) works, I just had the wrong db name.

I thought it could be any db name you want and it would create it in the new instance you are restoring to, but I realized that the db has to be match the name from the instance you use the mongodump command on

2
  • 1
    I just used mongorestore.exe --gzip --archive=..\..\old_data.agz and it made the old_data collection in my local MongoDB. Feb 25, 2021 at 8:54
  • The above worked for me well, Thanks !!
    – Mahesh G
    Mar 1, 2021 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .