cosa
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -26,6 +26,6 @@ var util = require('util'); | ||
var deferred = q.defer(); | ||
if (!/mongodb:\/\//.test(uri)) { | ||
this._uri = uri || process.env.COSA_DB_URI; | ||
if (!/mongodb:\/\//.test(this._uri)) { | ||
deferred.reject(new Error('invalid mongodb uri')); | ||
} | ||
this._uri = uri; | ||
debug('connecting to database: ' + this._uri); | ||
@@ -50,3 +50,3 @@ this._connectionStatus = 'connecting'; | ||
var deferred = q.defer(); | ||
if (this.connectionStatus === 'connected') { | ||
if (this._connectionStatus === 'connected') { | ||
debug('loading collection ' + name); | ||
@@ -58,3 +58,3 @@ this._db.collection(name, options, function (err, collection) { | ||
}); | ||
} else if (this.connectionStatus === 'connecting') { | ||
} else if (this._connectionStatus === 'connecting') { | ||
debug('waiting on connection before loading collection ' + name); | ||
@@ -69,3 +69,3 @@ this.on('connect', function () { | ||
} else { | ||
this.init(process.env.COSA_DB_URI) | ||
this.init() | ||
.then(function () { | ||
@@ -72,0 +72,0 @@ this._db.collection(name, options, function (err, collection) { |
{ | ||
"name": "cosa", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"description": "Cosa Models for MongoDB", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
86481