Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tests; clean up rebase mess

  • Loading branch information...
commit 663d911d288a7c7657f716772704518865395f5e 1 parent f6d2f9e
@aheckmann aheckmann authored
View
39 lib/drivers/node-mongodb-native/connection.js
@@ -113,51 +113,12 @@ NativeConnection.prototype.useDb = function (name) {
listen(newConn);
}
- // we have to manually copy all of the attributes...
- var newConn = new this.constructor();
- newConn.base = this.base;
- newConn.collections = {};
- newConn.models = {};
- newConn.replica = this.replica;
- newConn.hosts = this.hosts;
- newConn.host = this.host;
- newConn.port = this.port;
- newConn.user = this.user;
- newConn.pass = this.pass;
- newConn.options = this.options;
- newConn._readyState = this._readyState;
- newConn._closeCalled = this._closeCalled;
- newConn._hasOpened = this._hasOpened;
- newConn._listening = false;
-
- // Explanation for this whole mess:
- // First, when we create another db object, we are not guaranteed to have a
- // db object to work with. So, in the case where we have a db object and it
- // is connected, we can just proceed with setting everything up. However, if
- // we do not have a db or the state is not connected, then we need to wait on
- // the 'open' event of the connection before doing the rest of the setup
- // the 'connected' event is the first time we'll have access to the db object
- if (this.db && this.db._state == 'connected') {
- newConn.db = this.db.db(name);
- newConn.onOpen();
- // setup the events appropriately
- listen(newConn);
- } else {
- var self = this;
- this.once('connected', function () {
- newConn.db = self.db.db(name);
- newConn.onOpen();
- // setup the events appropriately
- listen(newConn);
- });
- }
newConn.name = name;
// push onto the otherDbs stack, this is used when state changes
this.otherDbs.push(newConn);
newConn.otherDbs.push(this);
-
return newConn;
};
View
2  test/connection.test.js
@@ -893,7 +893,7 @@ describe('connections:', function(){
})
})
- describe.only('connection pool sharing: ', function () {
+ describe('connection pool sharing: ', function () {
it('works', function (done) {
var db = mongoose.createConnection('mongodb://localhost/mongoose1');
Please sign in to comment.
Something went wrong with that request. Please try again.