I think it was already mentioned by someone above: Because MongoDB is configured in replica set mode it has different communication, replica set uses discovery mechanism for the set, the
member name in the configuration of the set and the host in the
connection must match. You need to do some kind of tricks with DNS to make this, e.g. host files or split-horizon DNS.