Can't create user on Atlas Cluster

I can’t create a user on my Atlas Cluster.

I get

Error: couldn't add user: CMD_NOT_ALLOWED: createUser :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15

I don’t seem to have any access to the admin databases on my Atlas account, neither cluster.

MongoDB Enterprise atlas-11dluf-shard-0:PRIMARY> use admin
switched to db admin
MongoDB Enterprise atlas-11dluf-shard-0:PRIMARY> show collections
MongoDB Enterprise atlas-11dluf-shard-0:PRIMARY> 

Debugging Atlas … sigh.

I see … apparently I can’t createUser() I just have to assign a user at cluster creation time, but there doesn’t seem to be a way to create more than one.

Wait wait wait! :slight_smile: Login to atlas cluster, on left side, there is a link “Database Access”, you can add users from there.

I am online now, let me know if any step is unclear, we will help you out.

Kanika

1 Like

I have the same issue here, i want to programmatically add users to databse using nodejs
db.addUser(dblogin, dbpassword, { roles: [ ‘readWrite’ ], db: dbname }

and got CMD_NOT_ALLOWED
user connected with atlas admin privilege
please help !

notice it was perfectly working with onpremise mongodb service running

You cannot create user for Atlas cluster.

You must use the gui or the Atlas API.

1 Like

Hi dear,

I’m new to Atlas and today I got seem an issue. Furthermore, I figure out how to do it first after you log into Atlas then click the Database Access tab then after in the pop page show then there you find the Specific Privileges section where you can set for example readWrite for a specific database