-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.4
-
Component/s: None
-
Labels:
-
Empty show more show less
http://mongodb.github.io/node-mongodb-native/driver-articles/mongoclient.html
Documentation there says it supports IP address ... but it does not say anything about IPv6.
Looking at the source, it seems it simply splits the host at the colon ":" ... which does not work when using IPv6 addresses (e.g. ::1)
// Split up the db hostPart = connection_part; // Parse all server results servers = hostPart.split(',').map(function(h) { var hostPort = h.split(':', 2); var _host = hostPort[0] || 'localhost'; var _port = hostPort[1] != null ? parseInt(hostPort[1], 10) : 27017; // Check for localhost?safe=true style case if(_host.indexOf("?") != -1) _host = _host.split(/\?/)[0]; // Return the mapped object return {host: _host, port: _port}; });
Should fix the documentation to explicitly say only IPv4 supported, or improve the parsing logic to handle IPv6.