Skip to content

Commit

Permalink
fix failing connection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Aug 17, 2011
1 parent 91263d9 commit fd1ce5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/mongoose/connection.js
Expand Up @@ -103,7 +103,7 @@ Connection.prototype.open = function (host, database, port, options, callback) {
break;
case 4:
if ('function' === typeof options)
callback = database, options = {};
callback = options, options = {};
}
} else {
switch (typeof database) {
Expand All @@ -112,6 +112,7 @@ Connection.prototype.open = function (host, database, port, options, callback) {
break;
case 'object':
options = database;
callback = port;
break;
case 'undefined':
options = {};
Expand All @@ -120,7 +121,7 @@ Connection.prototype.open = function (host, database, port, options, callback) {
uri = url.parse(host);
host = uri.hostname;
port = uri.port || 27017;
database = uri.pathname.replace(/\//g, '');
database = uri.pathname && uri.pathname.replace(/\//g, '');
}

callback = callback || noop;
Expand Down

0 comments on commit fd1ce5b

Please sign in to comment.