Skip to content

Commit

Permalink
Fix getting server
Browse files Browse the repository at this point in the history
  • Loading branch information
n1t0 committed Apr 3, 2019
1 parent b6b0a07 commit 737fbf3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/MongoManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export class MongoManager {
: `mongodb://${host.path}`;
const url = URL.parse(urlStr);
let hostname = url.host || host.path;
if (hostname.indexOf(':') === -1) {
hostname = `${hostname}:27017`;
}

if (this._servers[hostname] instanceof Server) {
// Already connected
Expand All @@ -46,10 +43,7 @@ export class MongoManager {
}

private getServer(name: string) {
if (name.indexOf(':') === -1) {
name = `${name}:27017`;
}
const server = this._servers[name];
const server = this._servers[name] || this._servers[`${name}:27017`];
if (!server) {
throw new Error('Server does not exist');
}
Expand Down

0 comments on commit 737fbf3

Please sign in to comment.