When I create backup of all databases in MongoDB (version 3):
mongodump --username bacUser --password 12345
It\'s OK. But when I try to cre
I was having this same problem when trying to dump my database info from mLab.
It was happening because I had mongo 2.x
locally and 3.x
in mLab.
Upgrading my local mongo to the same major version as mLab allowed me to do the dump, thus solving the problem.
If you use the --uri
option, you need to add authSource=admin as a parameter to your connection string (assuming your user is on the admin database)
mongodump --uri="mongodb://user:pass@host1:27017,host2:27017,host3:27017/?replicaSet=rs0"
Becomes:
mongodump --db=test --uri="mongodb://user:pass@host1:27017,host2:27017,host3:27017/?replicaSet=rs0&authSoource=admin"