incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <d...@muse.net.nz>
Subject Re: Data modelling
Date Thu, 12 Jul 2012 14:41:39 GMT
On 12 July 2012 15:47, Matthieu Rakotojaona
<matthieu.rakotojaona@gmail.com> wrote:
> 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

Matthieu,

Yes this is possible on a single instance but you can't guarantee
anything greater than a single document transaction as soon as you
subsequently use _changes, replication or views on top of that DB.

A+
Dave

Mime
View raw message