couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: CouchDB transactions?
Date Thu, 06 Feb 2014 23:19:14 GMT

On Feb 6, 2014, at 2:07 PM, Jo-Erlend Schinstad <joerlend.schinstad@ubuntu.com> wrote:

> So; is this possible now or will it be? Just to be clear; I'm not asking
> for relationships between documents, but merely a guarantee that a group of
> documents are updated simultaneously or not at all.

Probably not. You could implement transactional behavior on something like a single CouchDB
node, but it's not possible to guarantee it when documents are being replicated between nodes,
or in a multi-node cluster like BigCouch or Cloudant.

(If you refer to the CAP Theorem, this is a prominent side effect of the Consistency sacrifices
that CouchDB and related distributed databases make.)

There are other ways to model trees. The simplest is to just store a "parent" reference in
each document. This results in unordered sibling nodes, though. If you need ordering, you
can add an "order" property to each node, and then sort siblings by its value. To move a node
in the sibling order, you change its "order" property to something in between its new left
and right siblings'. The obvious types of values to use are floating-point numbers, but eventually
you run out of precision. I've also heard people propose strings — if you need to move a
node between siblings "a" and "ab" you can give it the order value "am".

—Jens
Mime
View raw message