I am trying to restore a MongoDB on an EC2 instance. I am currently running Mongo 4.0. I am restoring a .tgz, which I then unzip, and it contains a directory with all of my files. I previously used this command:
sudo mongorestore --db newDB mongoDump-2018-07-25-0200/viboDB/
Now that I am trying to update our database, I am getting the following error.
building a list of collections to restore from mongoDump-2018-07-25/0200 dir
Failed: viboBI2.Songs: error reading database: command listCollections requires authentication
I have logged into the mongo shell, and used db.auth() to authenticate as an admin. I have tried restarting mongo as well. Any help would be appreciated!
For restoring the Database you need to provide authentication.
mongorestore -u USERNAME -p PASSWORD --authenticationDatabase admin -d dbNAME PATH/TO/DIRECTORY
you can also provide host and port by adding -h
and --port
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With