1

I'm using Python to connect to MongoDB and using Ming (http://merciless.sourceforge.net/tour.html) to keep the data model consistent. It has some nice features that I really like, but unfortunately seems to have removed support for replica sets as of v0.3.0. Does anyone know if it's possible to get Ming 0.4.2 working w/ replica sets?

William White
  • 81
  • 1
  • 4

1 Answers1

1

Ming creator Rick Copeland got back to me with the answer to this one. The solution is to use create_engine and pass in the 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)

Thanks Rick!

William White
  • 81
  • 1
  • 4