wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
72 stars 59 forks source link

Improve atomicity of operations #13

Open mitar opened 12 years ago

mitar commented 12 years ago

Current implementation is really badly implemented as it is based on code which assumes transactions. For MongoEngine (and MongoDB) this is of course not true, so some improvements to operations should be done to implement them through atomic operations. And not through current fetch-update-save cycle.

Even worse is for subresources (lists), especially because we use indexes so things could move around and something would not be anymore on its place. You want to delete n-th element, but that element could be already something else at the time it is processed. Maybe we should introduce some dummy UUID/PKs to make sure we know what we are operating on. Operations on subresources should be really implemented through MongoEngine/MongoDB atomic operations on list and not changing list in the code.

mitar commented 11 years ago

Tastypie has some update_in_place function now. Is this the place to use MongoDB atomic operations to update documents?