Hello,
I am working through the lab for starting a replica set. The theory all makes sense. Just following the instructions.
When I am asked to add user I get:
m103-repl:PRIMARY> db.createUser({
… user: “m103-admin”,
… pwd: “m103-pass”,
… roles: [
… {role: “root”, db: “admin”}
… ]
… })
2020-08-24T09:05:25.024+0000 E QUERY [js] Error: couldn’t add user: not authorized on test to execute command { createUser: “m103-admin”, pwd: “xxx”, roles: [ { role: “root”, db: “admin” } ], digestPassword: true, writeConcern: { w: “majority”, wtimeout: 600000.0 }, lsid: { id: UUID(“7c7ac64f-b368-4c81-adfc-e19922028049”) }, $clusterTime: { clusterTime: Timestamp(1598259908, 1), signature: { hash: BinData(0, 1E6FB76579FFD388B1EF10ADA2EA87B40E42FA68), keyId: 6864471286588899329 } }, $db: “test” } :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1491:15
@(shell):1:1
I have started the primary node and connected to it. I also started the replica set.
Looking for some pointers on what I might be doing wrong.
Many thanks
Russell