Merge pull request #106 from imothee/mongoose-replica-set

Adds Replica Set Support to JugglingDB Mongoose Adapter
This commit is contained in:
Anatoliy Chakkaev 2012-08-12 22:47:50 -07:00
commit 5a981f4880
1 changed files with 6 additions and 1 deletions

View File

@ -29,7 +29,12 @@ exports.initialize = function initializeSchema(schema, callback) {
url = 'mongodb://' + url;
schema.settings.url = url;
}
schema.client = mongoose.connect(schema.settings.url);
if (!schema.settings.rs) {
schema.client = mongoose.connect(schema.settings.url);
} else {
schema.client = mongoose.connectSet(schema.settings.url, {rs_name: schema.settings.rs});
}
schema.adapter = new MongooseAdapter(schema.client);
process.nextTick(callback);
};