3 ms·
CouchDB has full ACID on a single document, so you can avoid these scenarios by writing everything that needs to happen in a transaction into a single document.
by jchrisa 16y ago
CouchDB has full ACID on a single document, so you can avoid these scenarios by writing everything that needs to happen in a transaction into a single document. Modeling your data like this means you are also more robust against partial replications (when using offline mode).
It is possible to do banking this way (CouchDB is probably better for banking than relational systems). Here's an example:
http://books.couchdb.org/relax/reference/recipes http://books.couchdb.org/relax/reference/recipes
- wanderr 16y agoI'm not too familiar with CouchDB in particular or what exactly a "document" is. Let's say I have a site about books. I need to be able to look up books by author, title, isbn and users who have it in their catalogue. Is there a way in CouchDB to ensure consistency while maintaining those relationships?
- jchrisa 16y agoYes, that's what the incremental map reduce indexes are used for. Each book would be a document, which you could query by any of those attributes. I'd store the fact that each user owns a book as it's own document, and then you can easily get a view of books by user, or of users by book.