Home work 2.4 TLS

Using the provided lab environment database VM, I have successfully completed the home
work, but there is something that is baffling me which I am not clear about the behaviour.

After starting the Mongod processes enabling TLS for the replica set, I thing logon using
mongo with the expected options.

When I run rs.initiate() all the members of the replica set in one go and run the validate script to check my output, I get the expected result.

But, if I run the rs.initiate() all the members in one go, and then create a user before running the validate script i.e

“db.createUser( {user: ‘admin’, pwd: ‘webscale’, roles: [{role: ‘root’, db: ‘admin’}]})”

– I get the following error message:-

vagrant@database:~/shared$ ./validate-hw-2.4.sh
2020-09-29T21:49:29.713+0000 E QUERY [thread1] TypeError: rs.status(…).members is undefined : @(shell eval):2:29

What is the reason behind this? As `i was trying to create an admin user in the database.

Does the lab ask you to create the user?

Try to authenticate the user and see

Hi,

No The lab does not ask to create the user. But under normal circumstances when you start up a new mongodb replica set you will need an admin user, to create other users in the database. As I have been following through all the labs and lectures, I have created many replica sets and one of the first things to do is create a user, that will be used to create other users.

ps: I did authenticate successfully.