Skip to content

Commit 39a61e3

Browse files
committed
NODE-508 SSL connections to Mongos will not complete
1 parent a7e1659 commit 39a61e3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/collection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Collection.prototype.insertMany = function(docs, options, callback) {
430430
// If keep going set unordered
431431
options['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions;
432432

433-
// Do we have keepGoing legacy o
433+
// Do we want to force the server to assign the _id key
434434
if(options.forceServerObjectId == null || options.forceServerObjectId == false) {
435435
// Add _id if not specified
436436
for(var i = 0; i < docs.length; i++) {

lib/mongos.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ var Mongos = function(servers, options) {
106106
// Add the store
107107
finalOptions.disconnectHandler = store;
108108

109+
// Ensure we change the sslCA option to ca if available
110+
if(options.sslCA) finalOptions.ca = options.sslCA;
111+
if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
112+
if(options.sslKey) finalOptions.key = options.sslKey;
113+
if(options.sslCert) finalOptions.cert = options.sslCert;
114+
if(options.sslPass) finalOptions.passphrase = options.sslPass;
115+
109116
// Socket options passed down
110117
if(options.socketOptions) {
111118
if(options.socketOptions.connectTimeoutMS) {

test/functional/promises_collection_tests.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ exports['Should correctly execute Collection.prototype.insertOne'] = {
2323
test.equal(100, db.serverConfig.connections().length);
2424

2525
db.collection('insertOne').insertOne({a:1}).then(function(r) {
26-
console.log("========================================================= 0")
26+
test.equal(1, r.insertedCount);
2727

2828
db.close();
2929
test.done();
30-
}).catch(function(err) {
31-
console.log("========================================================= 1")
32-
console.dir(err)
3330
});
3431
});
3532
}

0 commit comments

Comments
 (0)