We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d30bf6 commit 457bc29Copy full SHA for 457bc29
lib/url_parser.js
@@ -198,7 +198,13 @@ function parseConnectionString(url, options) {
198
for (i = 0; i < hosts.length; i++) {
199
var r = parser.parse(f('mongodb://%s', hosts[i].trim()));
200
if (r.path && r.path.indexOf(':') !== -1) {
201
- throw new Error('Double colon in host identifier');
+ // Not connecting to a socket so check for an extra slash in the hostname.
202
+ // Using String#split as perf is better than match.
203
+ if (r.path.split('/').length > 1 && r.path.indexOf('::') === -1) {
204
+ throw new Error('Slash in host identifier');
205
+ } else {
206
+ throw new Error('Double colon in host identifier');
207
+ }
208
}
209
210
0 commit comments