Hi Team,
I have a shard cluster with 3 config server and 3 QR server and 3 data servers. which means I have only one replica set for this shard cluster with version 5.0.
So in this setup all the data will be shard to that single replica set since we have only one replica set, So this shard cluster is no more needed and i need to migrate this shard cluster to normal replica set with 1 primary and 2 secondaries.
So we have tried the below approach to migrate this.
#1 First we have used the below command to remove the shared.
db.adminCommand( { removeShard: “mongodb0” } )

While executing this command we faced an error that we have only one shard and this is the last shared so this wont be deleted.
#2 So we have removed the entry for the shards collection from config database in QR server and try to execute the above command and it worked.
#3 Then we have shutdown the QR and config servers.
#4 Then we have hashed the below option in the config file of the data node. and taken a restart.
sharding:
clusterRole: shardsvr
After this process the node started working as a normal replica set.
Here my question is that, Is this correct approach to migrate from shard cluster to replica set or we have any other best practicess to do this.
Please let me know.