incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Kass <...@nhrevolution.com>
Subject Re: How could I use CouchDB in an e-commerce app?
Date Tue, 27 Oct 2009 16:34:30 GMT
Paulo,

If you are asking can couch be used for transactional systems, such as  
banking or payment processing...

The database itself doesn't have any transactional locking mechanism.  
However, as all documents are revisions... You could actually add  
multiple documents with a transaction_state field, and then upon  
completing the transaction update the transaction_state field in that  
document.

Because unlike SQL, there are no joins, foreign key restraints or  
cascading, in order to have a transaction that touches many "tables",  
you would need to rethink your data model to incorporate nested data  
structures in single documents.

One current deficiency is that you must retrieve documents in order to  
modify a field.  However this is easily abtracted in a library or  
class such that you could use a specified view to extract a subset of  
documents then loop through them to update a specified field, then  
either use bulk function or another loop to save the new version.

A function like this in use in psuedocode:

trans  = new CouchTransaction("myTransaction")
trans.start()
// do stuff
trans.add(doc,db)
trans.add(another_doc,another_db)
If (condition) {
     trans.commit()
}
trans.end()

I'm sure others would have better algorithms for what a  
CouchTransaction class might involve, but this is off the top of my  
head.

HTH,
Jim

Sent from my iPhone

On Oct 27, 2009, at 8:55 AM, Paulo Cassiano <pcassiano@gmail.com> wrote:

> I'm totally newbie in CouchDB, but I belive it could be ready for  
> production
> use. True. I only was thinking about how could I develop some e- 
> commerce app
> using it as DB server... Did you think about it before?
>
> On Tue, Oct 27, 2009 at 1:50 PM, Elf <elf2001@gmail.com> wrote:
>
>> Couchdb is ready for production use.
>>
>> 2009/10/27 Paulo Cassiano <pcassiano@gmail.com>:
>>> OK, infact, that's could be a much bigger question.
>>>
>>> But I think I'm not the only guy to think about this... If YOU  
>>> were asked
>> to
>>> do this, how did you do?
>>>
>>> On Tue, Oct 27, 2009 at 1:07 PM, Matt Goodall  
>>> <matt.goodall@gmail.com
>>> wrote:
>>>
>>>> 2009/10/27 Paulo Cassiano <pcassiano@gmail.com>:
>>>>> Every e-commerce app shows at least one product's picture, along  
>>>>> with
>>>>> descriptions and other useful information. Does CouchDB supports
>> images -
>>>>> JPEG, GIF and so on - files?
>>>>
>>>> Each CouchDB doc can have multiple attachments, see
>>>> http://wiki.apache.org/couchdb/HTTP_Document_API#Attachments.
>>>>
>>>> I would say a "product" makes an almost perfect CouchDB document.  
>>>> The
>>>> document itself could contain whatever data the product needed to
>>>> describe it (description, options, price, bulk prices, etc, etc)  
>>>> and
>>>> the images of the product would be its attachments.
>>>>
>>>>>
>>>>> How could I use CouchDB in an e-commerce app?
>>>>
>>>> That's a much bigger question ;-).
>>>>
>>>> - Matt
>>>>
>>>
>>
>>
>>
>> --
>> ----------------
>> Best regards
>> Elf
>> mailto:elf2001@gmail.com
>>

Mime
View raw message