coen-hyde / Shanty-Mongo

Shanty Mongo is a mongodb library for the Zend Framework. Its intention is to make working with mongodb documents as natural and as simple as possible. In particular allowing embedded documents to also have custom document classes.
Other
200 stars 52 forks source link

Replaces old Master / Slave stuff with a simple connection setup #109

Closed tonymillion closed 10 years ago

tonymillion commented 11 years ago

You can now setup connections to replica sets like:


    $connection = new Shanty_Mongo_Connection("mongodb://user:password@db.yourserver.com:27017");

    $connection->setSlaveOkay(true);    // optional to offload reads to slaves

    Shanty_Mongo::addConnection($connection);

as per the php-mongo docs your connection string can look like "mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test" or you can pass the replica set in as an array in a second param!

addConnection optionally takes a connection group just like the old stuff!

This fixes the problem with replica set connections I saw previously.

coen-hyde commented 11 years ago

Hey Tony,

Thanks for the pull request. This makes a lot of sense. There's no need for the master/slave stuff. Two things we need to do before we can merge this:

Can I suggest you create a separate branch from commit ad2dc97 and merge my master then create a pull request for that.

Cheers, Coen