Skip to content

Commit 9a70732

Browse files
committed
NODE-892 Passthrough options.readPreference to mongodb-core ReplSet instance.
1 parent adbebca commit 9a70732

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.2.14 2016-12-
2+
-----------------
3+
* Updated mongodb-core to 2.1.1.
4+
* NODE-892 Passthrough options.readPreference to mongodb-core ReplSet instance.
5+
16
2.2.13 2016-12-05
27
-----------------
38
* Updated mongodb-core to 2.1.0.

lib/replset.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,16 @@ ReplSet.prototype.isDestroyed = function() {
418418
}
419419

420420
// IsConnected
421-
ReplSet.prototype.isConnected = function() {
422-
return this.s.replset.isConnected();
421+
ReplSet.prototype.isConnected = function(options) {
422+
options = options || {};
423+
424+
// If we passed in a readPreference, translate to
425+
// a CoreReadPreference instance
426+
if(options.readPreference) {
427+
options.readPreference = translateReadPreference(options.readPreference);
428+
}
429+
430+
return this.s.replset.isConnected(options);
423431
}
424432

425433
define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]});

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongodb",
3-
"version": "2.2.13",
3+
"version": "2.2.14",
44
"description": "The official MongoDB driver for Node.js",
55
"main": "index.js",
66
"repository": {
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"es6-promise": "3.2.1",
1717
"mongodb-core": "2.1.0",
18+
"mongodb-core": "christkv/mongodb-core#2.0",
1819
"readable-stream": "2.1.5"
1920
},
2021
"devDependencies": {

test/functional/apm_tests.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ exports['Correctly receive the APM events for a listIndexes command'] = {
132132
test.equal(null, err);
133133

134134
db.collection('apm_test_list_collections').listIndexes({readPreference: ReadPreference.SECONDARY}).toArray(function(err, cols) {
135-
console.dir(err)
136135
// console.log(started[0].connectionId.port)
137136
// console.log(started[1].connectionId.port)
138137
test.equal(null, err);

0 commit comments

Comments
 (0)