You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ian Goodacre <Ia...@xtra.co.nz> on 2017/01/03 06:00:53 UTC

Re: Multi Doc Transaction

I am not an expert regarding CouchDB so cannot answer your question 
directly.

You might find the CouchDB Definitive Guide page on Eventual Consistency 
interesting <http://guide.couchdb.org/draft/consistency.html>. You 
should think carefully about your requirements for consistency.


On 28/12/2016 10:09, Kaveh Shahbazian wrote:
> Is there a way to do multi-doc transaction in CouchDB? Single Node? Cluster?
>
> CouchDB as a document database has some nice characteristics for developing
> an e-commerce system. For example a product can just get embedded inside
> the order! This way we have a snapshot of the product at that specific
> time. It needs lots of housekeeping in a RDBMS. Or dealing with instances
> of a product (instances of a SKU) is much nicer in the same way (if you are
> going to have an inventory too); which in turn provide interesting
> information in the long run for data analysis.
>
> But sometimes we just need a transaction.
>
> I've read some papers & blogs here & there and wondered if it is more
> feasible to do a total rewrite and use (say) PostgreSQL for my (rather
> small) website/app.
>
> But if there is already a simple to use utility for transactions in
> CouchDB, I could still enjoy the things CouchDB gives me and use the
> transaction part just when needed.
>
> Best;



Re: Multi Doc Transaction

Posted by Joan Touzet <wo...@apache.org>.
A common pattern to achieve what you are trying to do is to store
transactions as single documents, then use views to collate those
transactions into results. For instance, cash transactions (debits
and credits) are stored individually as documents, and the total
current balance is retrieved via a view lookup. Periodic rollups
can be done via view output and old document vacuuming, or by
periodic database rotation (on a monthly/yearly basis).

----- Original Message -----
> From: "Ian Goodacre" <Ia...@xtra.co.nz>
> To: user@couchdb.apache.org
> Sent: Tuesday, January 3, 2017 1:00:53 AM
> Subject: Re: Multi Doc Transaction
> 
> I am not an expert regarding CouchDB so cannot answer your question
> directly.
> 
> You might find the CouchDB Definitive Guide page on Eventual
> Consistency
> interesting <http://guide.couchdb.org/draft/consistency.html>. You
> should think carefully about your requirements for consistency.
> 
> 
> On 28/12/2016 10:09, Kaveh Shahbazian wrote:
> > Is there a way to do multi-doc transaction in CouchDB? Single Node?
> > Cluster?
> >
> > CouchDB as a document database has some nice characteristics for
> > developing
> > an e-commerce system. For example a product can just get embedded
> > inside
> > the order! This way we have a snapshot of the product at that
> > specific
> > time. It needs lots of housekeeping in a RDBMS. Or dealing with
> > instances
> > of a product (instances of a SKU) is much nicer in the same way (if
> > you are
> > going to have an inventory too); which in turn provide interesting
> > information in the long run for data analysis.
> >
> > But sometimes we just need a transaction.
> >
> > I've read some papers & blogs here & there and wondered if it is
> > more
> > feasible to do a total rewrite and use (say) PostgreSQL for my
> > (rather
> > small) website/app.
> >
> > But if there is already a simple to use utility for transactions in
> > CouchDB, I could still enjoy the things CouchDB gives me and use
> > the
> > transaction part just when needed.
> >
> > Best;
> 
> 
>