I have a mongodb replicaset on ubuntu.. In replica set, hosts are defined as localhost. You can see ;
{ \"_id\" : \"myrep\", \"version\" : 4, \"membe
There is a cleaner way to do this:
use local cfg = db.system.replset.findOne({_id:"replicaSetName"}) cfg.members[0].host="newHost:27017" db.system.replset.update({_id:"replicaSetName"},cfg)
then restart mongo