How to drain a MongoDB Shard
use dbversity db.dbfry.ensureIndex( { user_id : 1 }, { unique : true }) sh.enableSharding(“dbversity”) sh.shardCollection(“dbversity.dbfry”, {“user_id”:1}) sh.startBalancer() sh.getBalancerState() sh.isBalancerRunning() use dbversity for(var i = 1; i <= 100000 ; i++){db.dbfry.insert({“user_id” : i , “name” : “bulk-inserts”, ” Iteration: ” :…