[ZODB-Dev] Persisting Python objects in MongoDB

Roger dev at projekt01.ch
Wed Nov 9 07:21:38 UTC 2011


Hi Stephan

> Betreff: Re: AW: [ZODB-Dev] Persisting Python objects in MongoDB
> 
> On Wednesday, November 09, 2011 05:41:33 AM Roger wrote:
> > I still think it's just wrong to implement multi-object transactions
> > with a mongodb backend. And this is what mongopersist is based on.
> 
> I have not made any claim on how to use the code. You can call
> transaction.commit() after each object modification, if you like. Also, I
> assume that anyone interested in mongopersist is aware that MongoDB does
not
> provide transaction safety.
> 
> That said, I think that a large class of applications (or large parts of
an
> app) does not need transaction safety. In our application, for example,
most
> object modifications are compartmentalized, so that modifying small sets
of
> objects is pretty safe. The largest risk is posed by competing
modifications,
> which I tried to address using optional write-conflict detection.

This means we now have a persistent layer for mongodb like we have
with ZODB but we should not use it the same way as we whould with
the ZODB in our applications.


There are many use cases if you develope with mongodb where you
have to use an own application logic and m01.mongo and mongopersist
does not fit at any time. e.g. update the same properties for 2 or more
items at the same time. This could be done with an atomic mongodb
transaction and whould be done with 2 or more independent collection
calls with m01.mongo or mongopersist.

like:
collection.update({color: 'dark'}, {color: 'black'})

There are many other usecases where anything else then 
using an explicit pymongo connection is just a wrong.

All I can say is, that it's wrong to use persistence for hide the
mongodb from the developers. Then mongodb is very different
then a ZODB. The big question for me is, how simple is it to optimize
the implementation if you need to do so based on the used framework.

Regards
Roger Ineichen

> Regards,
> Stephan
> --
> 
> Entrepreneur and Software Geek
> Google me. "Zope Stephan Richter"




More information about the ZODB-Dev mailing list