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

use findandmodify in update #85

Closed tonymillion closed 12 years ago

tonymillion commented 12 years ago

This change uses findandmodify with returned object, so that the object in shanty matches the DB after Save()

currently if you call operations like inc() etc the object they are performed on becomes out of sync with the database after you call save(), often in a replica set you can't even read back the same object after a save as it may not have propagated to the other servers in the set.

coen-hyde commented 12 years ago

This looks like a great idea. I just ran the tests and at first they failed. The exception "MongoCursorException: norepl" was thrown. Then I commented out your replica specific code and it worked fine.

coen-hyde commented 12 years ago

It's in master now, minus your replica set specific stuff, though I would definitely like to see more support for replica sets.

In the future make sure you create a feature branch to create the pull request from.

tonymillion commented 12 years ago

Great, its my plan to sort out all the master/slave config stuff into a simple mongo:// connect string, and I'll include any replica set things in there.