I believe MongoDB's server side functions allow you to create an atomic grouping of operations.. i.e. store a function and call it by db.eval()
See the following:
http://www.mongodb.org/display/DOCS/Server-side+Code+Executi... http://www.mongodb.org/display/DOCS/Server-side+Code+Executi...
Thanks for the suggestion, but still not ideal. It performs a global lock on the DB which would block all operations while it computes.
Re:Why I'm So Happy About MongoDB
by stonemetal on Tuesday December 13, 2011 @01:33PM
(#3348595)
I tend to use a lock just long enough to write a transaction document. After you get the transaction captured in a document you can go back and fix up the primary documents without a lock.
The general consensus on this is to structure your data so that it encapsulates your business needs in one document structure (which is atomic on changes), but i find it hard to always conform to in the real world.
So now i have to use zookeeper (memcached also works) to setup global locks on those specific batch update actions. I guess it's a small price to pay right? Right?