couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Rakotojaona <matthieu.rakotoja...@gmail.com>
Subject Re: Data modelling
Date Thu, 12 Jul 2012 13:47:05 GMT
Just a precision :

On Thu, Jul 12, 2012 at 1:07 PM, Bernhard Gschwantner
<bernhard@unserwein.at> wrote:
> With that construction, you can be sure that it will never happen that you
> deduct an amount from one account and never add it to the other. If you
> make this two transaction documents, It could be that you try to create
> both documents, but only one succeeds. Or if you replicate your database,
> the first one is replicated, and then the network connection goes down.

You can use the _bulk_docs endpoint with the all_or_nothing option, to
use some kind of transaction :
http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Transactional_Semantics_with_Bulk_Updates

I know that replication uses the bulk API for putting the docs on the
target, but I don't know if it includes this option.

-- 
Matthieu RAKOTOJAONA

Mime
View raw message