Skip to content

Commit

Permalink
Removed authSource in normal Mongo Client
Browse files Browse the repository at this point in the history
  • Loading branch information
silvae86 committed Sep 12, 2018
1 parent 3ae105e commit ca46910
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/kb/gridfs.js
Expand Up @@ -40,6 +40,8 @@ GridFSConnection.prototype.open = function (callback, customBucket)
url = "mongodb://" + Config.mongoDBHost + ":" + Config.mongoDbPort + "/" + self.collectionName;
}

Logger.log("debug", "Connecting to GridFS using connection string: " + url);

MongoClient.connect(url, function (err, db)
{
if (isNull(err))
Expand Down
7 changes: 3 additions & 4 deletions src/kb/mongo.js
Expand Up @@ -10,7 +10,7 @@ function DendroMongoClient (mongoDBHost, mongoDbPort, mongoDbCollectionName, mon

self.host = mongoDBHost;
self.port = mongoDbPort;
self.collectionName = slug(mongoDbCollectionName);
self.collectionName = mongoDbCollectionName;
self.username = mongoDbUsername;
self.password = mongoDbPassword;
}
Expand All @@ -20,14 +20,13 @@ DendroMongoClient.prototype.connect = function (callback)
const self = this;

let url;
const sluggedCollectionName = slug(this.collectionName);
if (self.username && self.password && self.username !== "" && self.password !== "" && self.username !== "")
{
url = "mongodb://" + self.username + ":" + self.password + "@" + self.host + ":" + self.port + "/" + sluggedCollectionName + "?authSource=admin";
url = "mongodb://" + self.username + ":" + self.password + "@" + self.host + ":" + self.port + "/" + self.collectionName;
}
else
{
url = "mongodb://" + self.host + ":" + self.port + "/" + sluggedCollectionName;
url = "mongodb://" + self.host + ":" + self.port + "/" + self.collectionName;
}

MongoClient.connect(url, function (err, db)
Expand Down

0 comments on commit ca46910

Please sign in to comment.