I was doing the chapter Reads and Writes on a Replica Set
As instructed I stopped both secondary nodes and tried to connect to Primary node without using replica set id in the --host and I get the shell prompt as RECOVERING as in the image.

Also, rs.isMaster() is showing “secondary” : false. Attached image for reference. please suggest if this is fine or it takes some time before it will show as SECONDARY

Ok, it works now. I had Hidden Secondary node running. After stopping it Primary now showing as secondary


Hi @Pinaki_74783

There will be a short delay when a replica set election occurs but it looks like you have discovered this. Once the secondary members have lost connectivity to the primary for more than the configured timeout (10 seconds by default) then a replica set election is automatically triggered. You can find more details on this page about Replica Set Elections.

Do you have any other questions ?

Kindest regards,

Thaks Eoin for the details :+1: