Merge pull request #106 from imothee/mongoose-replica-set
Adds Replica Set Support to JugglingDB Mongoose Adapter
This commit is contained in:
commit
5a981f4880
|
@ -29,7 +29,12 @@ exports.initialize = function initializeSchema(schema, callback) {
|
||||||
url = 'mongodb://' + url;
|
url = 'mongodb://' + url;
|
||||||
schema.settings.url = 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);
|
schema.adapter = new MongooseAdapter(schema.client);
|
||||||
process.nextTick(callback);
|
process.nextTick(callback);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue