Skip to content

Instantly share code, notes, and snippets.

View brettkiefer's full-sized avatar

Brett Kiefer brettkiefer

View GitHub Profile
@brettkiefer
brettkiefer / repeatCounts.js
Created October 23, 2017 16:07
Demonstrate a failure to reconnect to a MongoDB replicaset when it loses a primary
// Run `npm i mongo` and run this test program after filling in the variables
// below. Run it against a replicaset with a sharded collection, with your
// MongoS process running on the same host as the script.
// You should // see start and finish messages from fxCountWithLog.
// Now do an rs.stepDown() on the replicaset primary. You should see an error
// message and the script should continue. So that's fine.
// Wait until the Replicaset settles down. Now on the new
// replicaset primary, do: