incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Metson <si...@cloudant.com>
Subject Re: Alternative to transactions
Date Thu, 14 Nov 2013 13:53:35 GMT
Hey Alex, 
Joan gave a nice talk yesterday with this sort of thing as a worked example: 

https://speakerdeck.com/wohali/10-common-misconceptions-about-apache-couchdb

Slide 23 onwards. Might help.
Cheers
Simon


On Wednesday, 13 November 2013 at 21:35, Alexander Vieth wrote:

> Hello,
> 
> In our application, we are modelling a directory hierarchy in CouchDB. We have a document
for each node (call them folders and files), and we would like to somehow express the hierarchy.
> 
> Our first attempt was to put a key "parent" on each folder and file, which is the identifier
of a folder or file. Folders would also have a key "children" which is an array of identifiers.
Trying to implement an API for moving a file or folder, we lamented the lack of support for
traditional SQL transactions. Such an action requires touching up to three documents: the
file/folder to be moved, its old parent, and its new parent. We need a guarantee that either
all of these changes succeed, or none of them go through. 
> 
> It seems (as far as we can tell) that the only way to get this guarantee from CouchDB
is to put all of the hierarchy information in a single document. However, we're cautious to
do this, because that document could conceivably become huge, and we don't want to fetch the
entire thing every time we wish to discover the parent or children of just one file or folder.
It's not clear whether it's possible to fetch just one key from one document. Can this be
done?
> 
> Are we approaching this problem in the wrong way? Any advice is appreciated.
> 
> Thanks!
> 
> Alex 



Mime
View raw message