Homework 1.2 check the output

after I received 3 errors I checked answer, all steps are the same that I used how can I check the correct output?

the mine is:

{ unauthorizedStatus: {"set":"TO_BE_SECURED","date":"2019-04-14T13:30:16.066Z","myState":1,"term":{"floatApprox":1},"heartbeatIntervalMillis":{"floatApprox":2000},"members":[{"_id":0,"name":"database:31120","health":1,"state":1,"stateStr":"PRIMARY","uptime":1486,"optime":{"ts":{"t":1555247861,"i":1},"t":{"floatApprox":1}},"optimeDate":"2019-04-14T13:17:41.000Z","electionTime":{"t":1555247433,"i":2},"electionDate":"2019-04-14T13:10:33.000Z","configVersion":3,"self":true},{"_id":1,"name":"database:31121","health":1,"state":2,"stateStr":"SECONDARY","uptime":759,"optime":{"ts":{"t":1555247861,"i":1},"t":{"floatApprox":1}},"optimeDate":"2019-04-14T13:17:41.000Z","lastHeartbeat":"2019-04-14T13:30:14.754Z","lastHeartbeatRecv":"2019-04-14T13:30:15.835Z","pingMs":{"floatApprox":0},"syncingTo":"database:31120","configVersion":3},{"_id":2,"name":"database:31122","health":1,"state":2,"stateStr":"SECONDARY","uptime":754,"optime":{"ts":{"t":1555247861,"i":1},"t":{"floatApprox":1}},"optimeDate":"2019-04-14T13:17:41.000Z","lastHeartbeat":"2019-04-14T13:30:14.754Z","lastHeartbeatRecv":"2019-04-14T13:30:13.257Z","pingMs":{"floatApprox":0},"configVersion":3}],"ok":1}, memberStatuses: ["PRIMARY","SECONDARY","SECONDARY"] }

this happes only after I added two strings in check file

statusStr="db = db.getSisterDB(‘admin’);
db.auth(’$username’, ‘$password’);

without them I wasn’t authenticated

@dasmeer

Sorry, but I really can’t tell what your question is, other than you don’t have the correct output. I would suggest that your replica set had already had auth enabled – did you run this multiple times? In any case, I’d kill the existing mongod instances in your VM and start over, doing each step only once. Also since this is a multi-step problem, keeps some detailed notes on what happens at each stage and post the results back here. I’ll try to help from there. Good luck.

thank you for the reply! by killing the existing mongod instances you meant using KILL command? do you know the way to kill everything about my mongod work to start from the blank sheet, is the only way is to delete vagrant instance and start all over again?

@dasmeer

You can use the kill command to remove the running mongod instances, or start over from the beginning by exiting Vagrant and destroying the existing instance. I’d probably just kill the processes and delete any data files, then start again. Notice that you do need to remove any data files, as MongoDB keeps information on the replica set in the data directories, and you won’t get a clean do-over without that. Good luck.