incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: Alternative to transactions
Date Thu, 14 Nov 2013 16:54:41 GMT

On Nov 13, 2013, at 1:35 PM, Alexander Vieth <alex@lagoa.com<mailto:alex@lagoa.com>>
wrote:

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.

All you really need is the ‘parent’ property. Then you define a view that emits the document’s
parent as the key. Now to find the children of a folder you just query that view with key=the
folder’s ID. (This is actually very much like the way you’d do it in a relational database.)

There’s now no need for transactions, because to move an item to a new folder you just change
its ‘parent’ property in a single update.

—Jens


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message