diff --git a/lib/manager.js b/lib/manager.js index 8b353dc2..0a33fde6 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -151,6 +151,9 @@ Manager.prototype.open = function (uri, opts, fn) { self.emit(eventName, e) }) }) + self.on('reconnect', function () { + self._state = STATE.OPEN + }) this.emit('open', this._db) } @@ -252,6 +255,15 @@ Manager.prototype.close = function (force, fn) { } } +/** + * Reconnects the connection. + */ + +Manager.prototype.reconnect = function () { + this.open(this._connectionURI, this._connectionOptions) + this._state = STATE.OPENING +} + /** * Lists all collections. *