Trip on creating user

I realized that we keep creating the m103-admin user over and again in multiple Labs. I have saved the command in a file called create_user.js. All we have to do is, login to the primary thru MongoDB shell and then run load(“create_user.js”);
Also please note that when creating new ReplicaSet, first run rs.initiate() on your first node in the replicaset before you run the create_user.js.

The content of the create_user.js is as follows

vagrant@m103:~$ cat create_user.js
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
});

1 Like

Hi @gdinakar,

Good job :clap: .

Thanks for sharing this with the community.

~ Shubham