Skip to content

Commit

Permalink
Added some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lindleycb committed Apr 20, 2018
1 parent 508959d commit a2ec1d8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/persistency/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ Persistency.prototype._execute = function(dbCall, argument, done) {
});
} else {
self._setWaitingForConnection();
console.log("Trying to get connection for URI: " + self.uri + " ...");
self._trace("Trying to get connection for URI: " + self.uri + " ...");
self._connect(function(error, db) {
var waitingForConnection = self._waitingForConnection();

if(error) {
console.log("ERROR: Could not get connection. URI: " + self.uri + " Error: " + error);
self._trace("ERROR: Could not get connection. URI: " + self.uri + " Error: " + error);
waitingForConnection.emit(connectionEventName, error); // we do this to stop waiting
self._resetConnection();
Expand All @@ -139,6 +141,7 @@ Persistency.prototype._execute = function(dbCall, argument, done) {
done(error);
}
} else {
console.log("Got connection '" + db.databaseName + "' URI: " + self.uri);
self._trace("Got connection '" + db.databaseName + "' URI: " + self.uri);
self._setConnection(db);
waitingForConnection.emit(connectionEventName, null, db);
Expand All @@ -151,6 +154,8 @@ Persistency.prototype._execute = function(dbCall, argument, done) {

Persistency.prototype._connect = function(done) {
MongoClient.connect(this.uri, this.options, done);
// uri = mongodb://localhost:3002/meteor
// TODO MongoClient.connect('mongodb://localhost:3002/', this.options, function(err, client) { var db = client.db('meteor'); done(err, db); });
};

/**
Expand Down

0 comments on commit a2ec1d8

Please sign in to comment.