Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1774A761E for ; Wed, 9 Nov 2011 16:30:35 +0000 (UTC) Received: (qmail 73516 invoked by uid 500); 9 Nov 2011 16:30:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 73480 invoked by uid 500); 9 Nov 2011 16:30:33 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 73472 invoked by uid 99); 9 Nov 2011 16:30:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 16:30:33 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yixiaoshen87@gmail.com designates 209.85.214.52 as permitted sender) Received: from [209.85.214.52] (HELO mail-bw0-f52.google.com) (209.85.214.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 16:30:27 +0000 Received: by bkbc12 with SMTP id c12so2271343bkb.11 for ; Wed, 09 Nov 2011 08:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=NQuMauGHWf/Qhx85MTpMX9NJBefmdTOX1gwqhx2dDwA=; b=nyorKT0cE4XPrfu4ESOcH7w4UtDddAYTnm2YM0pQTVjKhylfdcfbFqmYy0bBsn/zE5 BFEKEZGblJaYU4YUJqVdU4X+az0p/ITe23KSl7D0UQ1WRCE0FjT9Rv91icoxthxojk/n EkCqE2/DeUJE3zHOtNoTxwzx40GFuUG9+hOag= MIME-Version: 1.0 Received: by 10.182.7.66 with SMTP id h2mr1010792oba.14.1320856205179; Wed, 09 Nov 2011 08:30:05 -0800 (PST) Received: by 10.182.15.67 with HTTP; Wed, 9 Nov 2011 08:30:05 -0800 (PST) Date: Wed, 9 Nov 2011 11:30:05 -0500 Message-ID: Subject: how to update multiple fields in a doc From: YIXIAO SHEN To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=f46d044468d3e8ba1d04b14fcc04 --f46d044468d3e8ba1d04b14fcc04 Content-Type: text/plain; charset=ISO-8859-1 Hi all, I'm running a test on CouchDB, this test generates documents in CouchDB database and later randomly updates the documents. The parameter for the update is: id of the doc and map that indicates the fields of the doc to update. It doesn't have any knowledge of the doc version and I retrieved this information from CouchDB before updating. This is slow and in multi-thread environment this approach causes a lot of update conflicts. I have been reading about the update handler and it seems to me that this could be a possible way to go. But I'm having difficulty to implement this update function, can anyone give me an example of how to write such a function that can update multiple fields in a document, the fields to be updated is not predefined but randomly specified by the test application. Thanks --f46d044468d3e8ba1d04b14fcc04--