minimongo
minimongo copied to clipboard
Support MongoDB replica set connections / clients
This pull requests modifies options.py and model.py so that they support connecting to a MongoDB replicaset using the high-availability MongoReplicaSetClient.
Documentation for this client is available at http://api.mongodb.org/python/current/examples/high_availability.html.
This pull request updates the minimum required version of PyMongo from 1.9 to 2.4 on purpose, which is also done in the one other open pull request. This is needed not just for the high-availability client but also for MongoDB 2.2+ itself.
When replica sets are not configured, the behavior is the same as before, except it uses the current MongoClient instead of the old, deprecated Connection class.
While I was in there, I added a bit of DEBUG-level logging.
Definitely useful. Lets us use minimongo on production servers where failover is a necessity.
BTW:
(1) Sorry for not writing unit tests. I was getting general failures running unit tests without any of my code modifications, and I opened an issue for that (issue #30).
(2) I can squash commits if needed, into one prettier-looking commit message.
I agree this change is good and actually went ahead and implemented it in my own fork. Also using minimongo in production and see this as a valuable asset.