couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: Proposal for new feature: Auto Update Functions
Date Sun, 01 Jun 2014 17:35:09 GMT

On May 31, 2014, at 2:30 PM, Robert Samuel Newson <> wrote:

> The main trouble is loops. If couchdb edits the doc after the user edits it, this edit
is also replicated out to wherever you replicate to, which will make this edit again, and
then back again, and then back again.

I agree — this has some problematic interactions with the replicator.

If a document is replicated to two databases, and one of them uses this feature to modify
the document, the destination databases now contain two documents with the same doc and revision
ID but different contents. That explicitly breaks one of the invariants the replicator relies

(The same issue applies if both databases use this feature, but don’t make identical changes.
This could happen even if they’re both using identical auto-update functions, e.g. if the
auto-update adds a timestamp or a randomly-generated identifier.)

This can be averted if the auto-update is only used in the case where new_edits=true, i.e.
a normal PUT. Both because the replicator doesn’t use this mode, and because this mode assigns
a new revID, so it can be based on the post-processed doc’s contents.

View raw message