RubyからMongoDB shard clusterのbalancerを止める

ドキュメント探しても見つからなかったのでメモがてら

・commandメソッドで{databasCommand: 1}渡すと叩ける

 

gist.github.com

 

他のdatabase Commandもこれで叩ける

https://docs.mongodb.com/manual/reference/command/

 

ver3.2以前はbalancer関連のdatabase commandがないのでconfigサーバのsettingsテーブルを更新しにいく

gist.github.com