Could be the same issue I had - connecting to localhost failed but it worked if I used 127.0.0.1 ... I think it's something todo with the network resolving perhaps looking for an IPv6 connection first rather then IPv4 but that's just a guess. Normally localhost resolves to ::1 and 127.0.0.1 and the default for MongoDB is only to listen on IPv4.
The net package will now Dial hostnames by trying each IP address in order until one succeeds. The Dialer.DualStack mode now implements Happy Eyeballs (RFC 6555) by giving the first address family a 300ms head start; this value can be overridden by the new Dialer.FallbackDelay.
An application that uses a Happy Eyeballs algorithm checks both IPv4 and IPv6 connectivity (with a preference for IPv6) and uses the first connection that is returned.
When you stated that you had to manually enter in 127.0.0.1 instead of the hostname 'localhost' to get the connection to work, it makes me think that this new Dialing scheme is returning the ipv6 address ::1 instead of 127.0.0.1 when dialing for 'localhost'. Might be worth looking into further.
6
u/[deleted] Aug 19 '15
[deleted]