我使用Python连接到MongoDB,并使用Ming (http://merciless.sourceforge.net/tour.html)来保持数据模型的一致性。它有一些我真的很喜欢的很好的特性,但不幸的是,从v0.3.0开始,它似乎已经删除了对副本集的支持。有没有人知道有没有可能让Ming0.4.2在副本集上工作?
发布于 2013-11-05 03:03:59
明朝的创造者里克·科普兰给了我这个问题的答案。解决方案是使用create_engine并传入MongoReplicaSetClient:
bind = create_engine(
"Williams-iMac.local:27017,Williams-iMac.local:27018,Williams-iMac.local:27019",
replicaSet=replica_set_name,
read_preference=ReadPreference.PRIMARY_PREFERRED,
use_class=MongoReplicaSetClient)
datastore = create_datastore(db_name, bind=bind)谢谢,瑞克!
https://stackoverflow.com/questions/19548757
复制相似问题