I have created two users with below roles on my mongoinstance
use mydb
db.createUser(
{
user: "dbUser",
pwd: "dbPassword",
roles: [ { role: "dbOwner", db: "mydb" } ]
}
)
use admin
db.createUser(
{
user: "adminUser",
pwd: "adminPassword",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
MongoDb is up & running using above credentials, Now when i try to take mongodump using below command in terminal
mongodump --host localhost --port 27017 -u dbUser -p dbPassword --authenticationDatabase mydb
i am getting below error, not able to resolve this
connected to: localhost:27017
assertion: 13 not authorized on admin to execute command { getParameter: 1, authSchemaVersion: 1 }
Any idea? where i am doing wrong?
As suggested by @wdberkeley, problem got resolved by passing db name as parameter
below command runs fine
mongodump --host localhost --port 27017 -u dbUser -p dbPassword -d mydb
mongodump is not a Mongo shell command, it's an operating system command.
Just like you run mongo.exe to start the shell from OS prompt, you should run mongodump the same way from OS prompt. Example:
mongodump --host localhost --port 27017 -u dbUser -p dbPassword --authenticationDatabase mydb
Thanks
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