-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: MongoDB 3.2
-
None
-
Empty show more show less
When you have a 3 node replica set with 2 nodes down and connectWithNoPrimary:true, when calling db.createCollection it does not throw an error and just hangs there.
Nodejs Driver: 2.1.17
MongoDB: 3.2.6 and 3.0.11
Here is some sample code to test.
var MongoClient = require('mongodb').MongoClient , format = require('util').format; MongoClient.connect('mongodb://127.0.0.1:27030,127.0.0.1:27031,127.0.0.1:27032/beagles', { replSet: { connectWithNoPrimary:true, replicaSet: 'beagles', readPreference: 'primaryPreferred' } }, function (err, db) { if (err) { throw err; } else { console.log("successfully connected to the database"); } var collection = db.collection('dogs'); try { console.log("before insert"); db.createCollection("cats", {w: 1, wtimeout: 1000}, function(err, collection) { console.log(err); db.close(); }) console.log("after insert"); } catch(e) { throw e; } } );