Comparing version 1.1.0 to 1.1.1
@@ -53,8 +53,6 @@ var util = require('util'); | ||
}); | ||
} else { | ||
var init = (this.connectionStatus !== 'connecting') ? this.init(process.env.COSA_DB_URI) : q.resolve(); | ||
init.then(function () { | ||
debug('waiting on connection before loading collection ' + name); | ||
this.on('connect', function () { | ||
this._db.collection(name, options, function (err, collection) { | ||
} else if (this.connectionStatus === 'connecting') { | ||
debug('waiting on connection before loading collection ' + name); | ||
this.on('connect', function () { | ||
this._db.collection(name, options, function (err, collection) { | ||
if (err) { return deferred.reject(err); } | ||
@@ -64,4 +62,12 @@ debug('collection ' + name + ' loaded'); | ||
}); | ||
}); | ||
} else { | ||
this.init(process.env.COSA_DB_URI) | ||
.then(function () { | ||
this._db.collection(name, options, function (err, collection) { | ||
if (err) { return deferred.reject(err); } | ||
debug('collection ' + name + ' loaded'); | ||
deferred.resolve(collection); | ||
}); | ||
}.bind(this)); | ||
}.bind(this)); | ||
} | ||
@@ -68,0 +74,0 @@ return deferred.promise; |
{ | ||
"name": "cosa", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Cosa Models for MongoDB", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -10,3 +10,2 @@ var chai = require('chai'); | ||
require('../lib/index').init(); | ||
var Model = require('../lib/model'); | ||
@@ -13,0 +12,0 @@ var Immutable = require('../lib/immutable'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79818
2254