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 1978010B6E for ; Wed, 27 Nov 2013 08:25:41 +0000 (UTC) Received: (qmail 1643 invoked by uid 500); 27 Nov 2013 08:25:38 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 1598 invoked by uid 500); 27 Nov 2013 08:25:37 -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 1571 invoked by uid 99); 27 Nov 2013 08:25:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 08:25:36 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bchesneau@gmail.com designates 209.85.160.47 as permitted sender) Received: from [209.85.160.47] (HELO mail-pb0-f47.google.com) (209.85.160.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 08:25:30 +0000 Received: by mail-pb0-f47.google.com with SMTP id um1so9847259pbc.20 for ; Wed, 27 Nov 2013 00:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YPzK+FQCQBXWoYQpNae6+4xkTR7gnNxqSRrEXdhw0C0=; b=lHRDhXhxegPzWWoR3xZQFyTdV9DdZsxYmkHdOmt2P9BT4U7+BuCvzTQa+OE3LjqMc/ Y6R7pq0atoVfJaTZA7p8WfOXpRsWYGPV7+QQT9msB70GspBXf6zd02e9WwDqAwgfk33E St3aOF/Wb+YQltZ5CWZtGrg4Mhg06pdPcltxA2UZSFT8dRJbMD2JxCF3+A/0Q8Hsd7/R PRhXR4+Xt5BkGZp/biXmREvRv5S84RhLVG77iL5xw2tlhi1paqU+H4WuqepdnJlr1/xD Hh5K9Zg2NMlpHaZ4YlTa72sSol3maQjDTb83iyUA+QRCMnFTbdncQx3zeCf1OaYqZW1T cLyA== MIME-Version: 1.0 X-Received: by 10.68.193.131 with SMTP id ho3mr3847047pbc.81.1385540709171; Wed, 27 Nov 2013 00:25:09 -0800 (PST) Received: by 10.70.59.7 with HTTP; Wed, 27 Nov 2013 00:25:09 -0800 (PST) In-Reply-To: References: Date: Wed, 27 Nov 2013 09:25:09 +0100 Message-ID: Subject: Re: proposed feature - list function /update handler half baby From: Benoit Chesneau To: "user@couchdb.apache.org" Content-Type: multipart/alternative; boundary=047d7b15af4bcaca4a04ec2455d1 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b15af4bcaca4a04ec2455d1 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 27, 2013 at 4:49 AM, Stanley Iriele wrote: > Bulk updates in couchdb are a tad painful. you have to fetch them out of > the database apply your change and save them. > > I propose adding the ability to have something like an update handler that > folds across documents > > either in the way that lists do via get row > > ex. > > function (head, req){ > > while (var row = getRow()){ > row.doc.name = req.query.name; > send(row.doc)// except this commits the doc to disk or something here > } > > or something along this line...it could return an array over the wire like > bulk updates does....on a scale of 1 to 10 how bad of an idea is this? > mmm I was rather thinking to have something like : POST /db/_bulk_update?arg1=..&... { "docs" = [ doc1, ... docN ], "update_function": "function(doc, req) { ... return edited_doc; } } Would it works for you? - benoit --047d7b15af4bcaca4a04ec2455d1--