Skip to content

Commit 352d80d

Browse files
committedNov 6, 2015
fix; ability to use mongos for standalones (Fix #3537)
1 parent 043c958 commit 352d80d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎lib/drivers/node-mongodb-native/connection.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ NativeConnection.prototype.__proto__ = MongooseConnection.prototype;
4545

4646
NativeConnection.prototype.doOpen = function(fn) {
4747
var server = new Server(this.host, this.port, this.options.server);
48-
this.db = new Db(this.name, server, this.options.db);
48+
49+
if (this.options && this.options.mongos) {
50+
var mongos = new Mongos([server], this.options.mongos);
51+
this.db = new Db(this.name, mongos, this.options.db);
52+
} else {
53+
this.db = new Db(this.name, server, this.options.db);
54+
}
4955

5056
var self = this;
5157
this.db.open(function(err) {

0 commit comments

Comments
 (0)
Please sign in to comment.