How to control replica set member hostname?

I setup a single member rs with bindIp: localhost, I got member[0].host “”.

How can I control which name to be used as ?

You do this through your config file, try putting the first before the local host in the bindip.

When adding new members to the replica set make sure you do the rs.add with the hostname.

Thanks. I think this information should be in the official doc.